-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Design Meeting Notes, 8/18/2021 #45504
Comments
To add some thoughts to the tagged template examples:
|
Just the use case of /** @type {HTMLDivElement} */
const div = html`<div>
<${SomeComponent} fooProp=${123 /*fooProp accepts numbers only*/} />
<${SomeComponent} fooProp=${"bar" /*type error*/} />
</div>` is compelling enough. This means people can write type-safe DOM applications (or other applications in places similar to React native that render a declarative tree to native UI components), including type safety within the template string markup, without requiring a build step to transform JSX. For example, that code snippet could be pasted from VS Code (where the user would be able to catch errors in the html template) to CodePen and it would just work. |
I don't think that using a build-less setup is the wrong tool in every case. There are very valid reasons to use no build tools:
Furthermore, build steps can optionally compile template tag strings to optimized formats just like with JSX, with the benefit that code can be written one way and it would work in both build-less or build-full setups; optimization when needed. That, with added type safety, is a nice win. |
Why are type-safe tagged template strings the wrong tool for declaring Graphql queries and what would be a better solution? The graphql codgen https://www.graphql-code-generator.com/plugins/gql-tag-operations-preset provides something similar but has to use the somewhat awkward convention |
Well, a full parser would probably be infeasible anyway due to type instantiation and recursion limits, but a simplified parser that correctly infers the return type of the |
Please revisit generic type for template literals. |
Consistently Filtering Out Negative Matches when Narrowing
#45205
#41821
Playground Samples
obj1
andobj2
should not be related to whatever's being assigned.obj3
, but for various reasons we consider it to be "infinitely expanding" and just let that slip by the type system.So this avoids tracking "runs" of the same recurring type.
What do you do when you have two types that link back to themselves?
Tagged Template Inferrence and Making TemplateStringsArray
#31422
#33304
#45310
Notes from @RyanCavanaugh
tsa
looks like aReadonlyArray<string>
, plus araw
propertyT extends string
x
isTemplateStringsArray
TParts
andTRawParts
The text was updated successfully, but these errors were encountered: