You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Combination of intersections/partials causes invalid nested object type to not report error #51043
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:
interfaceUnrelated{_?: any}// Identical but distinct types.interfaceVariablesA{overrides?: OverridesInput;}interfaceVariablesB{overrides?: OverridesInput;}constfoo: Unrelated&{variables: VariablesA&VariablesB}={variables: {// Should be an error here:overrides: false}};
I would've expected some weak type checking on this one.
Activity
RyanCavanaugh commentedon Oct 4, 2022
DanielRosenwasser commentedon Oct 4, 2022
This was a little easier for me to read.
I would've expected some weak type checking on this one.
typescript-bot commentedon Oct 5, 2022
The change between release-4.4 and main occurred at 44e827b.
RyanCavanaugh commentedon Oct 5, 2022
Anders Hejlsberg (@ahejlsberg) thoughts? This changed in #47738
ahejlsberg commentedon Oct 11, 2022
The issue here is that when the target in a relation is an intersection, common property checks are only performed at the top level. For example:
We definitely should error in both of the examples above.