Bug Report
🔎 Search Terms
partial nested object type
🕗 Version & Regression Information
- This changed between versions 4.5.5 and 4.6.4. It reproduces in all versions since 4.6.4 (including nightly)
⏯ Playground Link
Playground link with relevant code
💻 Code
type OverridesInput = {
someProp?: 'A' | 'B'
}
const foo: Partial<{something: any}> & {variables: {
overrides?: OverridesInput;
} & Partial<{
overrides?: OverridesInput;
}>} = {variables: {overrides: false}};
🙁 Actual behavior
There is no error on the overrides field in the object. Changing the type of foo slightly (removing one of the intersections) causes the error to appear correctly, but this unique combination of types produces no error. Does not matter what the contents of OverridesInput is, nor what the content inside the outer partial (currently {something: any}) is. Additionally, the following all produce the error correctly:
type OverridesInput = {
someProp?: 'A' | 'B'
}
const foo: {variables: {
overrides?: OverridesInput;
} & Partial<{
overrides?: OverridesInput;
}>} = {variables: {overrides: false}};
type OverridesInput = {
someProp?: 'A' | 'B'
}
const foo: Partial<{something: any}> & {variables: {
overrides?: OverridesInput;
}} = {variables: {overrides: false}};
type OverridesInput = {
someProp?: 'A' | 'B'
}
const foo: Partial<{something: any}> & {variables: Partial<{
overrides?: OverridesInput;
}>} = {variables: {overrides: false}};
🙂 Expected behavior
There should be an error on the overrides field of the object since false is not assignable to OverridesInput | undefined.
Bug Report
🔎 Search Terms
partial nested object type
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
There is no error on the
overridesfield in the object. Changing the type offooslightly (removing one of the intersections) causes the error to appear correctly, but this unique combination of types produces no error. Does not matter what the contents ofOverridesInputis, nor what the content inside the outer partial (currently{something: any}) is. Additionally, the following all produce the error correctly:🙂 Expected behavior
There should be an error on the
overridesfield of the object sincefalseis not assignable toOverridesInput | undefined.