-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Record property string literal and <typeof classType["name"]> not working #47203
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
Comments
Your issue can be simplified to:
And then it's a duplicate of #43325, which was closed by the author in favour of #1579, which will most likely not happen in TypeScript. There's also #32527, which is basically the same as well. |
I think this is because |
Okey, thnx for the explanation. Is there another way to get the incoming types so it can be used as the property name on the returning object? To achieve the goal here or something similar? |
Only by passing a name manually. |
If you don't mind using plugins then I suggest https://github.com/dsherret/ts-nameof |
Bug Report
π Search Terms
typeof ["name"]
get class name
π Version & Regression Information
β― Playground Link
Playground Link
π» Code
π Actual behavior
The Record<
${Uncapitalize<typeof classType["name"]>}
, TClass1> does not set the propertyName to be the name of the classType.and both objects is merged into one. If i change it to hardcoded value like this: Record<
${Uncapitalize<'one'>}
it will work.π Expected behavior
The propertyNames should automatically be inferred by <typeof classType["name"]>
The text was updated successfully, but these errors were encountered: