We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
in keyof
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
typescript interface index signature keyof
Make in keyof accessible to interface index signature
Suppose I have a class which on construct adds some getters and setters to itself by the provided object interface
interface Base<T extends object = {}> { [K in keyof T]: T[K]; [key: string]: any; } class Base<T extends object = {}> { constructor(item: T) { this.foo = item.foo; } } const base = new Base({ foo: "bar" }); base.foo; // string base.bar; // any
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered:
Duplicate of #13573
Sorry, something went wrong.
No branches or pull requests
Search Terms
typescript interface index signature keyof
Suggestion
Make
in keyof
accessible to interface index signatureUse Cases
Suppose I have a class which on construct adds some getters and setters to itself by the provided object interface
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: