-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infer Subtypes from Template Literal Types #43907
Comments
I was able to kind of work around this limitation by using the string value "0" instead of It seems to randomly cause "Type instantiation is excessively deep and possibly infinite". I'm open to other workarounds that might not cause so much recursion if anyone has any! You can see changes here, I marked the comments with CHANGE: |
For a real world example, here is Formik with the above integration, with strongly typed Fields which enforce valid https://codesandbox.io/s/serene-napier-4wjxs?file=/src/App.tsx |
This seems to work in nightlies, right? |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Suggestion
π Search Terms
Inference
Template Literal Types
Subtypes
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
I'd like to be able to infer a subtype from a template literal type. For example:
π Motivating Example
This will allow cross-matching between Values and Paths when traversing an object with dot notation.
π» Use Cases
See line 35, in this Playground
The text was updated successfully, but these errors were encountered: