An alternative option to keyofStringsOnly
that stringifies numeric properties and index signatures
#43041
Open
5 tasks done
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Suggestion
🔍 Search Terms
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Since pattern literal types like
`${number}`
are valid as of #40598, I feel like there should be an option to make:result in:
The same should happen for any numeric property key:
like with:
📃 Motivating Example
This makes
keyof
and numeric index signatures match runtime behaviour.💻 Use Cases
Currently, it’s necessary to use the
strictKeyof
andStrictPropertyKey
helpers:Relevant issues:
ProxyHandler
#35594 (comment), fix(lib/es2015): Fix definition ofProxyHandler
#35594 (comment), fix(lib/es2015): Fix definition ofProxyHandler
#35594 (comment)Reflect
methods #41987This will most likely depend on #26797, so that treating numeric index signatures as numeric pattern literal index signatures is valid:
The text was updated successfully, but these errors were encountered: