Inconsistent Behavior with readonly
in Template Literal Indexed Access Types
#58035
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
๐ Search Terms
"readonly" "template literal" "index signatures"
๐ Version & Regression Information
v5.4.3
โฏ Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAogHgQwLZgDbQLxQN4CgpQDacAXFAAYAk2AzsAE4CWAdgOYC+AtMAo6uQF0ydJm3xFSFABYQEAE07URLDoOEMV4+rLkB7ZqhASy5GfMW0NbLjz5qoysQW3z9h4xREXHqoQ6usuOy4uHIQAMaoCNpQ4fp0UMAQdGTwyGgQIUl0hADkXlIIhbkCUFi5AIwATADMuVnJwHlmCoWF3LyoJWVQlbX1uKCQUAAqFT0ACozhANYAPGko6AA0UDMQILoAZrCISxAAfLgA9McEUAB6APy4QA
๐ป Code
๐ Actual behavior
I have encountered an inconsistent behavior when using
readonly
with template literal indexed access types in TypeScript. Specifically, when a string template index signature extends another string template index signature, attempts to mark it asreadonly
seem to be ignored in the resulting type when usingPick<Type, keyof Type>
.๐ Expected behavior
The keyword
readonly
should be retained, or an error prompt should be given when adding it at the beginning.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: