Skip to content
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

Add non-nullable modifier to return type of functions never returning null #1322

Merged
merged 1 commit into from
Feb 5, 2021

Conversation

vrana
Copy link
Contributor

@vrana vrana commented Mar 11, 2020

No description provided.

@vrana vrana requested a review from a team as a code owner March 11, 2020 13:23
@codecov
Copy link

codecov bot commented Mar 11, 2020

Codecov Report

Merging #1322 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1322   +/-   ##
=======================================
  Coverage   94.61%   94.61%           
=======================================
  Files          33       33           
  Lines        1708     1708           
  Branches      416      416           
=======================================
  Hits         1616     1616           
  Misses         92       92

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c2b25c...1d56ee9. Read the comment docs.

@keithamus
Copy link
Member

Could you please explain the motivation for this change?

@vrana
Copy link
Contributor Author

vrana commented Feb 4, 2021

In Closure type system, Array actually means Array or null, it's equivalent to ?Array. This removes the null from the return type declaration because the function never returns null. It means that you will be able to assign to a variable declared as !Array.

@keithamus
Copy link
Member

Are you aware if these changes have ramifications to other consumers of JSDoc, such as TypeScript? Is this valid JSDoc syntax?

@vrana
Copy link
Contributor Author

vrana commented Feb 5, 2021

Yes, this is valid JSDoc syntax. https://jsdoc.app/tags-type.html

I believe TS would consume this just fine as it is used in many other projects.

@keithamus keithamus merged commit 61feee1 into chaijs:master Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants