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 '{ a: { a: number; }; b: { b: number; }; }' is not assignable to type 'X'.
Type '{ a: { a: number; }; b: { b: number; }; }' is not assignable to type '{ [key: string]: { a: number; }; }'.
Property 'b' is incompatible with index signature.
Property 'a' is missing in type '{ b: number; }' but required in type '{ a: number; }'.
π Expected behavior
No type error
The text was updated successfully, but these errors were encountered:
The term "overloaded indexed type" doesn't really convey what you're doing. The behavior here is working as intended.
It looks like you're trying to write a "rest index signature" type as requested in #17867 (and mentioned in SO here), and unfortunately there's not really any great way to do it. An intersection is okay-ish to read from but you can't easily initialize it, as you can see.
Bug Report
π Search Terms
"Overloaded indexed type"
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Type error:
π Expected behavior
No type error
The text was updated successfully, but these errors were encountered: