-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Provide upgrade tooling for --strictOptionalProperties
#44419
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
Comments
@sandersn made a tslint rule with a |
@orta I think many projects use |
Like I did in microsoft/dtslint#335, I would call the rule |
I noticed a bunch of DefinitelyTyped PRs to add
|
The key with these automated PRs is that they are 'backwards' compatible in the sense that 4.4 behavior with However, post the PRs it now easy to switch the semantics to be more accurate on a case by case basis, in comparison to before where support for So for React, that |
Quick notes from the tslint rule
|
As discussed in #45032, using a TS codefix across a whole codebase is a poor migration strategy for |
I've been curious about the comments on it not being a good migration strategy. The strategy was applied to large projects of DefinitelyTyped in a single go, including React Native in DefinitelyTyped/DefinitelyTyped@694c663 before we brought the typings into our own package. It has since been applied inconsistently, and making matters more confusing, our actual source is Flow, which does allow passing undefined. So, to not be more strict than the source, we need to add this. But it is no guarantee it actually works. Since all of the properties are already modded to allow explicit undefined, I did add the ESLint rule for now. |
Background
For TypeScript 4.4, we anticipate that users using
--strictOptionalProperties
will have fairly mechanical transformations on individual properties. For exampleprobably should just get rewritten to
We'd like to provide some basic tooling to run through a project's declarations to ensure that properties are "upgraded" appropriately.
Basic constraints
tsconfig.json
, or a set of understood files to make this work correctly.node_modules
,lib.d.ts
, or other files that are outside the control of a user.Open questions
The text was updated successfully, but these errors were encountered: