Repository navigation
Design Meeting Notes, 2/16/2018 #22011
Description
Activity
- addedDesign NotesNotes from our design meetingsNotes from our design meetings
on Feb 17, 2018 KiaraGrouwstra commented
on Feb 17, 2018 ContributorMore actionsWell damn it, if you can already do it with object types, why make it ugly to do with regular conditional types?
well, the new conditional types solve type-level type checks.
Now that error suppression is being discussed, I'd like to propose also adding a compiler flag for reporting unused suppressions. #22021
Reacted by Mikhail BusyrevIt seems like the discussion on
@ts-ignorewent something like:- Error codes are unclear
- So, short names? But they have a host of other problems
- And some other points too
I'd just like to toss out: at my place of work we would gladly use unclear error codes, if it gave us the ability to suppress errors. Heck, we'd use savage personal insults, as long as it allowed us this functionality.
We have a large JS application we're migrating to TS. We'd like to turn on the
--strictNullChecksand--noImplicitAnyflags, squelch the errors in old code, and be protected in new code. Currently, we're just turning on those flags, chipping away at the errors, then turning them back off (time permitting).This will work eventually, but in the meanwhile there is nothing preventing us from introducing new null & implicit any errors. (I mean, there are diligent code reviews, but who trusts humans? That's why we use static type checking in the first place.)
TL;DR: we don't care if it's pretty, we just want the compiler to yell at us for bad null handling
Reacted by Ashish Chandwani, Adrien Guéret and NokolaRyanCavanaugh commented
on Apr 26, 2018 MemberMore actionsAlex Burner (@alexburner) what about the current ts-ignore functionality is blocking you from that approach?
One possible path would be to build once, write a quick script to insert
@ts-ignores in the erroring lines, and then go back to try to remove them. I believe that's what Google does when they upgrade or turn on new flags.Just the specificity, we don't want to throw the baby out with the bathwater. All of our current TS code compiles fine otherwise, we only want to suppress the
--strictNullChecksand--noImplicitAnyerrors.RyanCavanaugh commented
on Apr 26, 2018 MemberMore actionsThe real problem (I'm surprised this didn't make it into the notes) is that we generally don't consider a different error message being issued as a significant breaking change.
For example, we sometimes add a more-specific error message for certain cases to give a better developer experience. Every error message has its own distinct error code.
We don't want people to get into a situation where upgrading from TS X.Y to X.Y+1 yields hundreds of new errors simply because we changed an error message code, or end up doing a bunch of Rube Goldberg work in the checker to issue a "legacy" error message in some cases.
In this case, we'd be down for that danger! It would still be an improvement over our current situation (and, ideally, we wouldn't be leaning on these "ignores" at some point in the future).
But, I do see how this makes things ugly, from a general public perspective. You don't want to be responsible for innocent bystanders receiving new errors during upgrading. And supporting legacy error messages sounds like a pain.
Is there any way this could be released as an experimental/volatile feature? Some sort of marketing/positioning that made it clear users are opting in to unpredictable behavior?
RyanCavanaugh commented
on Apr 27, 2018 MemberMore actionsThe extent to which we've tried that is basically
--experimentalDecorators, and now hundreds of millions of lines of Angular code depend on it and we can realistically never change it without adding a complex set of back-compat flags to keep supporting the current behavior.The rando who shows up on HN or Twitter to trash TypeScript 3.7 because it put hundreds of new errors in his codebase isn't going to disclaim that he had
--makeUpgradesImpossibleenabled, and why would he? A different engineer turned that flag on without asking or telling anyone. Still not his fault, though - Why would TypeScript add such a dangerous flag in the first place? Bad decision making over at Microsoft.Then he's here on the issue tracker along with everyone else who got opted into a janky build system requesting that we add an
--ignoreIgnoreMessagesflag to ignore the message part of the ignore.Then we need another flag to specify when they don't don't want to not ignore a
ts-ignore, then... 😢Reacted by Mohamed HegazyReacted by kiara and Aaron BeallThen we need another flag to specify when they don't don't want to not ignore a
ts-ignore, then... 😢Okayyyy okay okay, I now viscerally understand the pains of supporting an open source project on this scale. Thank you for playing out this thought experiment with me, I will let you be 😅
Reacted by Ryan Cavanaugh- locked and limited conversation to collaborators
on Jul 31, 2018
Recursive Conditional Types
#21316 (comment)
Ais assignable toBinA extends B) requires evaluatingA.Ais a conditional type, either branch needs to be evaluated immediately to see if it satisfiesB. That means you can end up exhausting your instantiation stack.Ignore specific errors with
@ts-ignorecommentsIssue: #19139
PR: #21602
--pretty?