This repository was archived by the owner on Feb 16, 2021. It is now read-only.
This repository was archived by the owner on Feb 16, 2021. It is now read-only.
ObjectOmit
does not carry across properties from all variants in union #11
Open
Description
Is this expected behaviour? Here are two examples using ObjectDiff
and ObjectOmit
.
import { ObjectDiff, ObjectOmit } from 'typelevel-ts/lib';
{
type Common = {
commonProp: string;
};
type Full = Common &
(
| {
type: 'foo';
foo: string;
}
| { type: 'bar'; bar: string });
type Defaults = Pick<Full, 'commonProp'>;
type Input = ObjectDiff<Full, Defaults>;
const check = (i: Input) => i;
check({
type: 'foo',
foo: 'foo', // unexpected error
});
check({
type: 'bar',
bar: 'bar', // unexpected error
});
}
{
type Common = {
commonProp: string;
};
type Full = Common &
(
| {
type: 'foo';
foo: string;
}
| { type: 'bar'; bar: string });
type Input = ObjectOmit<Full, 'commonProp'>;
const check = (i: Input) => i;
check({
type: 'foo',
foo: 'foo', // unexpected error
});
check({
type: 'bar',
bar: 'bar', // unexpected error
});
}
Metadata
Metadata
Assignees
Labels
No labels