Tagged template literal syntax would be 💯💯 #1055
lucashooten
started this conversation in
Ideas
Replies: 1 comment
-
I agree this could be very powerful. I do still think in most cases, this approach provides worse DX than the current syntax, which does a better job reusing JS's natural structure to parallel TS: const UserType = type({
userName: "string",
street: "string",
zip: "number",
country: "'US' | 'UK'"
}) The benefits of this are:
That said, there are still cases where this would be useful, especially for inlining an object definition in a string. I've actually commented on a TS PR that would make stuff like this possible for cases where it was beneficial. If you'd like to have syntax like this, please add your thoughts here as that is the main blocker to getting it! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Extraordinary work friends, thank you for investing the time in this. A hesitant suggestion, but throwing it out there: since the goal of runtime typing seems to be "get as close to pure typescript as possible", tagged template literals could provide a pretty fantastic experience for declaring types.
Beta Was this translation helpful? Give feedback.
All reactions