V8: Replacing the Path type #7389
felixschorer
started this conversation in
RFC
Replies: 1 comment 7 replies
-
I would recommend exposing |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Problem
Path
can produce very large union types for nested form data.TypeScript Performance
See #7290.
Developer Experience
When entering a path, IntelliSense will display the suggested paths in alphabetical order. That results in "deeper" paths being placed above the immediately following paths.
See this TS Playground.
When entering
"foo"
the following suggestions will be shown.Notice, that
"foo.foo"
is only the 5th suggestion, and that completely unrelated paths are suggested.Proposed Solution
LazyPath
(Function Arguments)In places where
Path
is used to describe a function argument, one can use a type which validates the string using template literal type inference.This has been implemented in this Code Sandbox.
Other Use Cases
Path
can be used outside of function arguments. However,LazyPath
can only be used for function arguments.For those cases something like #7354 could be used.
cc @barrymay @kotarella1110 @jorisre
Beta Was this translation helpful? Give feedback.
All reactions