-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple index signatures allowing different index types #44468
Comments
Sounds like a duplicate of #26797. |
#26797 is a blocking issue however I also don't want TypeScript to restrict object literal types ( |
I'm not sure what you mean by "is a blocking issue".
The linked issue does not impose a restriction like that. It's even mentioned explicitly that multiple signatures should be possible:
|
Correct! I've got that PR version installed staged on my VM and multiple index signatures work. |
Suggestion
π Search Terms
Multiple more than one index type property signature type specific member mapping TypeScript TS
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Put further restrictions on index signatures being mapped to member types, driven by the type of the index signature. Basically add multiple index signatures to an interface that map different type keys to different type members. Hugely increases the power of index signatures. Blocked by #26797.
π Motivating Example
This:
Could be more accurately specified as:
π» Use Cases
The
vscode
repo is full of interface collections that could make immediate use of this..The text was updated successfully, but these errors were encountered: