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
"return type validation" "mapped type resolved to any" "template literals"
Happens on every version I tried since 4.1.5 (previous versions says, that operator 'as' isn't available).
Playground link with relevant code
type MappedKeys<T extends string, TBase={bar: unknown, baz: unknown}> = { [key in keyof TBase as `${T}_${string & key}`]: number } function mapKeys<T extends string>(prefix: T): MappedKeys<T> { return "No type controll :(" } const a = mapKeys("foo"); a.foo_bar
Typescript shows no error for mapKeys function return type.
Typing a. suggests that a is an object and has two fields - a.foo_bar and a.foo_baz.
Typescript compiler should show error when returned type isn't matching declared return type.
The text was updated successfully, but these errors were encountered:
I guess it's related to limitations mentioned here:
#23918 #23433
When I remove generic prefix, checks work fine.
Sorry, something went wrong.
No branches or pull requests
Bug Report
🔎 Search Terms
"return type validation"
"mapped type resolved to any"
"template literals"
🕗 Version & Regression Information
Happens on every version I tried since 4.1.5 (previous versions says, that operator 'as' isn't available).
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Typescript shows no error for mapKeys function return type.
Typing a. suggests that a is an object and has two fields - a.foo_bar and a.foo_baz.
🙂 Expected behavior
Typescript compiler should show error when returned type isn't matching declared return type.
The text was updated successfully, but these errors were encountered: