We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem? Please describe.
Firstly, devcontainer to test a problem. https://codesandbox.io/p/sandbox/wpkrx7
I struggled how to get name of string index of object type. For example, for this type I want to extract projectId identifier.
projectId
type ProjectJobTypePeriodVal = { [projectId: string]: { name: string duration: string } }
By debugging and search in sources I came to this solution
const indexType = type.getStringIndexType(); // expect this not undefined const keyName = type.compilerType.checker .getIndexInfosOfType(type.compilerType)[0] .declaration.locals.keys() .next().value; // finally keyname is `projectId`
Describe the solution you'd like
I am expecting my solution is bad. Maybe I missed a proper function or approach?
Describe alternatives you've considered
My alternative described above.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
Firstly, devcontainer to test a problem.
https://codesandbox.io/p/sandbox/wpkrx7
I struggled how to get name of string index of object type.
For example, for this type I want to extract
projectId
identifier.By debugging and search in sources I came to this solution
Describe the solution you'd like
I am expecting my solution is bad. Maybe I missed a proper function or approach?
Describe alternatives you've considered
My alternative described above.
The text was updated successfully, but these errors were encountered: