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
// This works.typeFoo<Textends{}>={readonly[KinkeyofT]: string;};// This doesn't.typeBar<Textends{}>={get[KinkeyofT](): string;};
π Actual behavior
Bar doesn't compile. The compiler says:
A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
Property '[K in keyof' implicitly has type 'any', because its get accessor lacks a return type annotation.
π Expected behavior
Both type declarations above should work in the same way.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
keyof get computed name
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.0-dev.20231226#code/C4TwDgpgBAYg9nAPAFShAHsCA7AJgZygG8BfAPigF5iAoKeqAJwgENc5sAbEKAbQGkoAS2xQA1hBBwAZlGQBdAFxR8wRiIDmAbhokdNUJCgAhFoxRpMOAsXJVaDKBojA+gkeMky58gBQBKZVV1bG1dLSA
π» Code
π Actual behavior
Bar
doesn't compile. The compiler says:π Expected behavior
Both type declarations above should work in the same way.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: