Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

no-redundant-undefined: enforce undefined for optional parameters #335

Merged
merged 7 commits into from
Jul 8, 2021

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Jun 29, 2021

Previously, both optional parameters and optional properties forbid undefined in their type. Now optional properties require it so that people can use exactOptionalPropertyTypes with packages from DT.

To avoid "no-redundant-undefined means redundant-undefined!?", I also renamed the lint rule. There are only 17 projects that turn off this rule, so I think it's easy to rename along with all the other changes that this rule will cause in DT.

@sandersn
Copy link
Member Author

I'm going to wait to merge this until I can clean up DT to pass -- and I need to ship a new version of dtslint in a day or two for the beta before then.

sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with x-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with w-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with x-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with v-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with v-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with u-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
* Add undefined to optional properties, part W

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with w-.
microsoft/dtslint#335

* Update types/wordpress__block-editor/components/media-placeholder.d.ts

dedupe multiple undefineds created by tslint --fix

Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with u-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with tl--ty-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with tf--ti-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
* Add undefined to optional properties, part TL

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with tl--ty-.
microsoft/dtslint#335

* fix bad merge of typopo
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add
undefined to all optional properties. #no-publishing-comment

This PR covers packages starting with tf--ti-.
microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers widely used packages, those with more then 100,000
packages per month, from react-measure -- react-slick

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers widely used packages, those with more then 100,000 packages per month, from react-slider -- regenerate

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers widely used packages, those with more then 100,000 packages per month, from regenerator -- rimraf.

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers widely used packages, those with more then 100,000 packages per month, from regenerator -- rimraf.

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with o- and following.

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with h- and following.

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with d- and following.

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with a- and following.

microsoft/dtslint#335
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
* Add undefined to optional properties, React to Regenerate

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers widely used packages, those with more then 100,000 packages per month, from react-slider -- regenerate

microsoft/dtslint#335

* Fix errors in react

* Missed fix to react-table

* add missed parens to conditional type
@sandersn
Copy link
Member Author

sandersn commented Jul 7, 2021

@wandyezj points out that it doesn't make sense to require optional properties to have undefined in their type now that there's a semantic distinction. Lots of packages will want to disallow it now that that's possible.

However, plenty of people won't know about the distinction at first, meaning that some new types will incorrectly exclude undefined. I don't think it can be helped, though, so I'm going to remove the requirement for properties now that I've used it to upgrade them.

I expect over time that @a-tarasyuk's eslint rule will grow configuration options that allow people either to upgrade old code or keep new code appropriately strict.

sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
* Add undefined to optional properties, part D

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with d- and following.

microsoft/dtslint#335

* reformat for shorter line length

* Add missing whitespace
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
* Add undefined to optional properties, part A

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with a- and following.

microsoft/dtslint#335

* reformat for shorter line length
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
* Add undefined to optional properties, part O

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with o- and following.

microsoft/dtslint#335

* shorten max line length
sandersn added a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request Jul 7, 2021
* Add undefined to optional properties, part H

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with h- and following.

microsoft/dtslint#335

* shorten line lengths
sandersn added 2 commits July 8, 2021 15:04
Including undefined, or not, is now semantically meaningful when
exactOptionalPropertyTypes is true.
@sandersn sandersn merged commit 76886d9 into master Jul 8, 2021
@sandersn sandersn deleted the redundant-undefined branch July 8, 2021 22:41
Jytesh pushed a commit to Jytesh/keyv-types that referenced this pull request Oct 2, 2021
* Add undefined to optional properties, part H

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with h- and following.

microsoft/dtslint#335

* shorten line lengths
Jytesh pushed a commit to Jytesh/keyv-types that referenced this pull request Oct 2, 2021
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers widely used packages (more than 100,000 downloads per
month) from karma-chrome-launcher -- mimos
microsoft/dtslint#335
Jytesh pushed a commit to Jytesh/keyv-types that referenced this pull request Oct 2, 2021
* Add undefined to optional properties, part H

In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment

This PR covers non-widely used packages starting with h- and following.

microsoft/dtslint#335

* shorten line lengths
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants