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
String templates doesn't work with nested generics and keyof
5.2.2, 5.3
https://www.typescriptlang.org/play?ts=5.3.2#code/JYOwLgpgTgZghgYwgAgIIB4AqyIA9IgAmAzsgEoQID2Uh6xYUoA5gDTINMjMB8yA3gChkyEBAYRCALmSZBAX0FKYAVxAIwwKiGRwsOfBCKkM-YNI6MW8njwAUYGZgCUA4cgBGD9gHJzP1wB6QORmKipCdy8wXwBafyCQgCEVZgB+BUFVdU1tT308AhI0dDgQAE9bByd2YhpHZABrCHKqGFkAbR8xCUIfAF1kADJLLmZkAB9kAANYgBJ+Ztb2zC6eyD7Bkc5radchTKA
interface A<T extends Record<string, string> { nested: T } function a<T extends A<{id: string}>>(t: T) { b(t, 'id') // good b(t, '-id') // Bug? } function b<T extends A<any>>(t: T, sort: keyof T['nested'] & string | `-${keyof T['nested'] & string}`) { }
Template string doesn't work as expected
The example should compile without error
No response
The text was updated successfully, but these errors were encountered:
Yeah, that ought to work. Here's a simpler repro:
function a<T extends {id: string}>() { let x: keyof T & string | `-${keyof T & string}`; x = "id"; // Ok x = "-id"; // Error, but should be ok }
Sorry, something went wrong.
ahejlsberg
Successfully merging a pull request may close this issue.
π Search Terms
String templates doesn't work with nested generics and keyof
π Version & Regression Information
5.2.2, 5.3
β― Playground Link
https://www.typescriptlang.org/play?ts=5.3.2#code/JYOwLgpgTgZghgYwgAgIIB4AqyIA9IgAmAzsgEoQID2Uh6xYUoA5gDTINMjMB8yA3gChkyEBAYRCALmSZBAX0FKYAVxAIwwKiGRwsOfBCKkM-YNI6MW8njwAUYGZgCUA4cgBGD9gHJzP1wB6QORmKipCdy8wXwBafyCQgCEVZgB+BUFVdU1tT308AhI0dDgQAE9bByd2YhpHZABrCHKqGFkAbR8xCUIfAF1kADJLLmZkAB9kAANYgBJ+Ztb2zC6eyD7Bkc5radchTKA
π» Code
π Actual behavior
Template string doesn't work as expected
π Expected behavior
The example should compile without error
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: