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
If you really want this, you can use an intersection type instead: { test: { url: string } } & { [key: string]: string }
But be aware that this is not sound. It's easy to still assign a string to the property test.
π Search Terms
[key: string]: string override other types
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.5#code/C4TwDgpgBAKhDOwoF4oG8BQUrAcAXOlAK4BOANoYqQJYB2A5lAL4DcWUA2gNYQhXBajALoChDdmyA
π» Code
π Actual behavior
Throw error in test because is not a string
π Expected behavior
Doesn't throw an error
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: