You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeRegistry={a: {a1: {}}b: {b1: {}}}typeKeyof<T>=keyofT&stringfunctionf1<ScopeextendsKeyof<Registry>,EventextendsKeyof<Registry[Scope]>>(eventPath: `${Scope}:${Event}`){const[scope,event]=eventPath.split(":")console.log(scope,event)}functionf2<ScopeextendsKeyof<Registry>,EventextendsKeyof<Registry[Scope]>>(scope: Scope,event: Event){// It errors here with:// Argument of type '`${Scope}:${Event}`' is not assignable to parameter of type '`${Scope}:${Keyof<Registry[`${Scope}`]>}`'.(2345)f1(`${scope}:${event}`)}
🙁 Actual behavior
When calling the function f1 with a template literal value built with the same types than the template literal type parameter, it errors with:
Argument of type '${Scope}:${Event}' is not assignable to parameter of type '${Scope}:${Keyof<Registry[${Scope}]>}'.(2345)
🙂 Expected behavior
When calling the function f1 with a template literal value built with the same types than the template literal type parameter, I would expect no error.
Additional information about the issue
The message error message has changed over time, in versions 4.1.5 and 4.2.3 it was:
Argument of type 'string' is not assignable to parameter of type 'never'. (2345)
Since version 4.3.5 it is:
Argument of type '${Scope}:${Event}' is not assignable to parameter of type '${Scope}:${Keyof<Registry[${Scope}]>}'.(2345)
The text was updated successfully, but these errors were encountered:
🔎 Search Terms
template literal not assignable
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAShDmBLAzsATiKBeKBvAUFEVAIYBcepAjBbgL5R2HEBGtULNeDTT+okKAGkIIAPYAzADwAVAHzYoAa1GSoMqADIoqNIgB28fPgkBXfQGNgiMfqgSqU5kQDKFsYIgAPYBH0ATZGFVaTgkXRA5ABpnKABRADc-YChvXwCgkXFQhBR0EABtNw8IAF05fDkACggk-WAABRJgAAsKAAMAElxiyDoybsTkunaASjxY931UKALkd0go1LrgUsVa5KbWgDpkMAAbRGAqgCIyE9HJ22QxfYht-bF4KvmSpY36y74zS2tbewATE5iFBetA0n5AsFslIwnkMNFYkN6qkfJDMiFYbkIkUFmUKtVXpAKGD3isKMjgOMCCCHFUurgiRB+t0PsARl98EA
💻 Code
🙁 Actual behavior
When calling the function
f1
with a template literal value built with the same types than the template literal type parameter, it errors with:🙂 Expected behavior
When calling the function
f1
with a template literal value built with the same types than the template literal type parameter, I would expect no error.Additional information about the issue
The message error message has changed over time, in versions 4.1.5 and 4.2.3 it was:
Since version 4.3.5 it is:
The text was updated successfully, but these errors were encountered: