-
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, 5/10/2023 #54228
Comments
i wouldnt say that - i think that many in the PR comments welcome this improvement. It’s just that many think (myself included) that for certain use cases it feels like a needless requirement put on the final consumer of the API. Some APIs are just designed in a way that would require this at call site - and at that point, why not allow it somehow to be the default behavior of the signature? If i have to say to all of my users “u need to use |
Just wanted to reiterate that as @Andarist suggests, I am a big proponent of incremental progress so long as there is a consensus around how it could eventually fit in to a full solution👍 |
I think these two passages are effectively saying the same thing. i.e. "Yeah, it's an improvement, but I'd really prefer if there was a better way..."
I suspect this is exactly the reason for the caution here - if said incremental progress involves a new feature, then the way to use that feature now has to then be maintained for backward compatibility even if a different, better way comes along later--and now you have multiple ways to do the same thing (even though one of the ways is effectively legacy baggage) and people get into unproductive style wars over it. So I'm only for incremental progress if what's implemented now is a proper subset of what all will eventually be implemented. |
I'm quite amused by this because it reminds me of when people write unsound generic functions/classes and then get confused when the compiler yells at them. The compiler knows the function isn't safe but the coder doesn't realize that because they're only thinking of cases where the type parameter gets inferred. There's no type theoretical basis for that kind of thinking (a type parameter implies universal quantification), but that's what ends up happening simply because TypeScript's design makes explicit type arguments an antipattern. |
Maybe i misread the design notes late in the night - it read to me a little bit as if we were not recognizing |
I would just echo this 100 times over, because the entire reason we're in a difficult spot here in the first place is that generic defaults were sort of rushed in, when we should have really done partial inference for unspecified type parameters instead. it's significantly easier to do the right version of a feature first than to do the OK version and then a better version later. |
I wrapped up the transformer stuff into a concrete-ish issue on #54276. |
In light of what @RyanCavanaugh and @fatcerberus mentioned, I think a more concrete way to say this would've been that I think that a final decision should be made on syntax for both call-site and declaration-site inferred parameters before either is added to the language. That said, I do think we have a few promising options for each, so I do hope to see one of them in a nightly build in the not too distant future🙏 |
Transformer Plugins
customTransformers
tsc
command?Program
- are they effectively doing type-directed emit?EmitResolver
for something like runtime type-checks, or minification, or whatever.customTransforms
have existed for over 5 years, always been an asymmetry (if not just annoying) that you have to use a bundler or write a wrapper fortsc
.plugins
array.type
is a new field for each plugin entry."type": "transform"
or whatever."type": "watch"
plugins
customTransformers
.--allowPlugins
flag.Type Argument Placeholders and Feedback
#26349
foo<SomeType, _, _, _>
even if it's an improvement fromfoo<SomeType, VeryLongType, VeryLongType, VeryLongType>
impl trait
types, etc.preferinfer
?preferinfer
says "no no no, the default isn't desirable. You want this thing to be optional, but to use inference as a fallback if it's not specified".preferinfer
at this moment - it feels like the scope is narrow.The text was updated successfully, but these errors were encountered: