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
Type '{ path: string; children: { path: string; title: string; }[]; }' is not assignable to type 'RouteWithTitle'.
Type '{ path: string; children: { path: string; title: string; }[]; }' is not assignable to type 'Route'.
Types of property 'children' are incompatible.
Type '{ path: string; title: string; }[]' is not assignable to type 'ChildrenFn | Route[] | undefined'.
Type '{ path: string; title: string; }[]' is not assignable to type 'Route[]'.
Type '{ path: string; title: string; }' is not assignable to type 'Route'.
Object literal may only specify known properties, and 'title' does not exist in type 'Route'.(2322)
🙂 Expected behavior
The type of the object inside children should be RouteWithTitle and no error should occur.
Extracting the child to a const "fixes" the error even though no more type info is given to the compiler:
RyanCavanaugh
changed the title
TypeScript is unable to infer correct type in one of two seemingly equal cases
Incorrect excess property error when assigning to intersected array
Feb 9, 2021
I reverted the fix to this because both excess and common property checks are handled by the same flag in assignability, and @types/mongodb relies on common property checks for some correct errors. Decoupling these checks is likely to be extremely complex to verify and therefore not worth it.
Bug Report
🕗 Version & Regression Information
Tested in 3.3.3 and 4.2.0-beta and Nightly
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Compile error highlighting
title: "Empty"
:🙂 Expected behavior
The type of the object inside
children
should beRouteWithTitle
and no error should occur.Extracting the child to a
const
"fixes" the error even though no more type info is given to the compiler:Playground link with the code that works
The text was updated successfully, but these errors were encountered: