-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Element: Add types #21248
Element: Add types #21248
Conversation
Size Change: -3 B (0%) Total Size: 889 kB
ℹ️ View Unchanged
|
"noImplicitAny": false, | ||
"strictNullChecks": false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing these lines:
noImplicitAny
-> 51 errorsstrictNullChecks
-> 7 errors- both -> 60 errors
ca897c8
to
c3549e2
Compare
7088eae
to
d3fe07e
Compare
Rebased and removed commits from #20669 which has been merged. |
Allow function or class components, rather than just class components.
Co-Authored-By: Andrew Duthie <[email protected]>
Co-Authored-By: Andrew Duthie <[email protected]>
06b1bf9
to
8bed5cf
Compare
Rebased to fix conflict. Would it be possible to move forward with this? Many packages depend on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* @return {WPComponent} Dangerously-rendering component. | ||
* @return {JSX.Element} Dangerously-rendering component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered how this worked.
Turns out it doesn't:
[0] /home/travis/build/WordPress/gutenberg/packages/element/src/raw-html.js
[0] 20:0 warning The type 'JSX' is undefined jsdoc/no-undefined-types
https://travis-ci.com/github/WordPress/gutenberg/jobs/314225929
I thought these rules were upgraded to be errors in #20427. I think this one might have been missed? (cc @sainthkh)
I know we have a handful of temporary exceptions for custom types, but pretty sure those are hard-coded to be exceptions and could still exist even if the rule were upgraded from warning to error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a concern with restoring the element types? #21781
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happened because I missed this one rule:
gutenberg/packages/eslint-plugin/configs/jsdoc.js
Lines 82 to 83 in 5bd92c6
'jsdoc/no-undefined-types': [ | |
'warn', |
I opened an issue that fixes it: #21942.
Description
Add types/typechecking to
@wordpress/element
. Many other packages that would be extremely valuable to type, namely@wordpress/data
and@wordpress/components
, depend on this package. Typing it unblocks a lot of work on other package typings.Add
unknown
andnever
TypeScript types to allowed JSDoc types.✅
Includes squash-merged #20669, necessary for some required types.Part of #18838
How has this been tested?
npm run build:package-types
passes.Screenshots
Types of changes
New feature: Add types
Checklist: