-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Blocks: Try adding TypeScript type checking and improved JSDoc #16552
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
Conversation
|
Just a note: most of the errors reported are the result of one of the following things:
Once those two problem areas are wiped out, you'd probably be able to count the issues on 2 hands. Hope the output is not too daunting! |
I would be curious to know whether all of the syntaxes used here are compatible with Specifically things like:
gutenberg/packages/blocks/src/api/children.js Line 130 in 38cfb2e
However, I would agree with treating this as a separate task. In general, I think it could benefit to pair this effort down to separate pull requests. This one can be a good test ground for getting the work done, then proceeding to extract individual commits for their own pull requests to simplify review (this is what I've done with similar large efforts like #14715, #15226, #3745). |
|
I'm catching up with your open PRs to see if I didn't miss anything important which would block your efforts. Is #17014 an alternative try to tackle something much simpler first? :)
This one is fixed now and I see that this PR also adds |
Sorry about that. Yeah, this I think was too much for the first PR. We can go ahead and close this for now and I'll come back and cherry pick from this later after the simpler packages are done. 👍 |
Whatever you feel works better for you. The only issue with stale PRs is that you need to rebase them from time to time which might be challenging if the span hundreds of lines :) |
|
Nah that's fine. I'll either reopen this or redo it later on. You're free to close if you'd like. |
|
I closed this one, we have enough number of open PRs to track 😅 |
Description
This PR is the result of a week or so of on and off tinkering in the JSDoc and several weeks of submitting PRs to DefinitelyTyped for typescript type definitions.
The gist: This PR adds initial TypeScript compile-only (no-emit) type checking for just the
blockspackage.The goal of this PR is threefold:
go to definititionin VSCode to see detailed documentation for all types.You'll notice that this PR is not free of errors. Indeed, at the time of writing this, there are 133 reported problems with the
blockspackage. Most of these problems are valid, however a good portion of these are problems with the type definitions which will need to be fixed upstream.If you're using an editor with TypeScript support, all you'd need to do to begin being productive is open up any file within the
blockspackage and you'll see the errors inline.If you don't have an editor with TypeScript support, simply run
npx tscanywhere in the project for a print out of all of the errors in your terminal.I probably left out a bunch of info, so please feel free to discuss any concerns/questions/comments freely and I'll do my best to resolve those.
Here is a list of the currently reported errors for the record
packages/blocks/src/api/factory.js(60,38): error TS2532: Object is possibly 'undefined'. packages/blocks/src/api/factory.js(69,40): error TS2345: Argument of type '"html" | "meta" | "text" | "attribute" | "query" | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. packages/blocks/src/api/factory.js(140,101): error TS2339: Property 'isMultiBlock' does not exist on type 'Transform'. Property 'isMultiBlock' does not exist on type 'TransformEnter'. packages/blocks/src/api/factory.js(160,60): error TS2339: Property 'blocks' does not exist on type 'Transform'. Property 'blocks' does not exist on type 'TransformEnter'. packages/blocks/src/api/factory.js(167,103): error TS2339: Property 'blockName' does not exist on type 'Transform'. Property 'blockName' does not exist on type 'TransformBlock'. packages/blocks/src/api/factory.js(172,29): error TS2339: Property 'isMatch' does not exist on type 'Transform'. Property 'isMatch' does not exist on type 'TransformEnter'. packages/blocks/src/api/factory.js(173,32): error TS2339: Property 'isMultiBlock' does not exist on type 'Transform'. Property 'isMultiBlock' does not exist on type 'TransformEnter'. packages/blocks/src/api/factory.js(174,20): error TS2339: Property 'isMatch' does not exist on type 'Transform'. Property 'isMatch' does not exist on type 'TransformEnter'. packages/blocks/src/api/factory.js(230,49): error TS2532: Object is possibly 'undefined'. packages/blocks/src/api/factory.js(243,40): error TS2339: Property 'blocks' does not exist on type '(TransformBlock & { blockName: string; }) | (TransformEnter & { blockName: string; }) | (TransformFiles & { blockName: string; }) | (TransformPrefix & { blockName: string; }) | (TransformRaw<...> & { ...; }) | (TransformShortcode<...> & { ...; })'. Property 'blocks' does not exist on type 'TransformEnter & { blockName: string; }'. packages/blocks/src/api/factory.js(247,2): error TS2322: Type '(Block> | undefined)[]' is not assignable to type 'Block>[]'. Type 'Block> | undefined' is not assignable to type 'Block>'. Type 'undefined' is not assignable to type 'Block>'. packages/blocks/src/api/factory.js(369,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. packages/blocks/src/api/factory.js(369,27): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. packages/blocks/src/api/factory.js(410,13): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. Type 'undefined' is not assignable to type 'boolean'. packages/blocks/src/api/factory.js(414,13): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. Type 'undefined' is not assignable to type 'boolean'. packages/blocks/src/api/parser.js(194,50): error TS2345: Argument of type '"html" | "meta" | "text" | "attribute" | "query" | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. packages/blocks/src/api/parser.js(264,10): error TS2339: Property 'type' does not exist on type 'Source'. packages/blocks/src/api/parser.js(264,16): error TS2339: Property 'enum' does not exist on type 'Source'. packages/blocks/src/api/parser.js(273,8): error TS2678: Type '"property"' is not comparable to type '"html" | "text" | "children" | "tag" | "attribute" | "node" | "query"'. packages/blocks/src/api/parser.js(291,26): error TS2339: Property 'default' does not exist on type 'Source'. Property 'default' does not exist on type 'Attribute'. packages/blocks/src/api/parser.js(308,37): error TS2532: Object is possibly 'undefined'. packages/blocks/src/api/parser.js(309,43): error TS2345: Argument of type 'BlockAttribute' is not assignable to parameter of type 'Source'. Type 'Meta' is not assignable to type 'Source'. Property 'attribute' is missing in type 'Meta' but required in type 'Attribute'. packages/blocks/src/api/parser.js(339,10): error TS2339: Property 'deprecated' does not exist on type 'Block> | undefined'. packages/blocks/src/api/parser.js(449,32): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. packages/blocks/src/api/parser.js(466,4): error TS2345: Argument of type '{ attrs: Record; blockName: string | null; innerBlocks: any[] | readonly Block[]; innerContent: readonly string[]; }' is not assignable to parameter of type 'Block'. Property 'innerHTML' is missing in type '{ attrs: Record; blockName: string | null; innerBlocks: any[] | readonly Block[]; innerContent: readonly string[]; }' but required in type 'Block'. packages/blocks/src/api/parser.js(473,4): error TS2345: Argument of type '{ attrs: Record; blockName: string | null; innerBlocks: any[] | readonly Block[]; innerContent: readonly string[]; }' is not assignable to parameter of type 'Block'. packages/blocks/src/api/parser.js(485,29): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. packages/blocks/src/api/parser.js(489,16): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: Block, index: number, array: readonly Block[]) => U, thisArg?: any) => U[])' has no compatible call signatures. packages/blocks/src/api/parser.js(502,3): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. packages/blocks/src/api/parser.js(550,18): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: string, index: number, array: readonly string[]) => U, thisArg?: any) => U[])' has no compatible call signatures. packages/blocks/src/api/parser.js(558,31): error TS2345: Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'. packages/blocks/src/api/raw-handling/blockquote-normaliser.js(15,7): error TS2339: Property 'innerHTML' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/blockquote-normaliser.js(15,41): error TS2339: Property 'innerHTML' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/figure-content-reducer.js(64,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/figure-content-reducer.js(65,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/figure-content-reducer.js(67,3): error TS2322: Type '(Node & ParentNode) | null' is not assignable to type 'ChildNode'. Type 'null' is not assignable to type 'ChildNode'. packages/blocks/src/api/raw-handling/figure-content-reducer.js(73,3): error TS2322: Type 'HTMLElement | null' is not assignable to type 'ChildNode'. Type 'null' is not assignable to type 'ChildNode'. packages/blocks/src/api/raw-handling/figure-content-reducer.js(79,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/figure-content-reducer.js(81,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/google-docs-uid-remover.js(11,14): error TS2339: Property 'id' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/google-docs-uid-remover.js(11,25): error TS2339: Property 'id' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/head-remover.js(15,2): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/image-corrector.js(22,12): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(23,8): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(27,12): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(28,37): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(32,9): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(42,9): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(55,8): error TS2339: Property 'src' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(59,12): error TS2339: Property 'height' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(59,33): error TS2339: Property 'width' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.js(60,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/image-corrector.native.js(14,12): error TS2339: Property 'height' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.native.js(14,33): error TS2339: Property 'width' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/image-corrector.native.js(15,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/index.js(68,73): error TS2722: Cannot invoke an object which is possibly 'undefined'. packages/blocks/src/api/raw-handling/index.js(81,11): error TS2339: Property 'transform' does not exist on type 'Transform>'. packages/blocks/src/api/raw-handling/index.js(81,22): error TS2339: Property 'blockName' does not exist on type 'Transform>'. packages/blocks/src/api/raw-handling/list-reducer.js(26,27): error TS2339: Property 'previousElementSibling' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/list-reducer.js(34,8): error TS2339: Property 'children' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/list-reducer.js(41,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/list-reducer.js(54,39): error TS2339: Property 'previousElementSibling' does not exist on type 'Node & ParentNode'. packages/blocks/src/api/raw-handling/list-reducer.js(59,4): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/list-reducer.js(61,4): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/list-reducer.js(61,4): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/list-reducer.js(62,4): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/list-reducer.js(62,4): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/list-reducer.js(62,39): error TS2345: Argument of type '(Node & ParentNode) | null' is not assignable to parameter of type 'Node'. Type 'null' is not assignable to type 'Node'. packages/blocks/src/api/raw-handling/list-reducer.js(68,29): error TS2339: Property 'previousElementSibling' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/ms-list-converter.js(14,21): error TS2339: Property 'getAttribute' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/ms-list-converter.js(33,24): error TS2339: Property 'previousElementSibling' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/ms-list-converter.js(38,16): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/ms-list-converter.js(46,3): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/ms-list-converter.js(49,24): error TS2339: Property 'previousElementSibling' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/ms-list-converter.js(56,25): error TS2339: Property 'firstElementChild' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/ms-list-converter.js(82,2): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/normalise-blocks.js(28,11): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/normalise-blocks.js(35,5): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/normalise-blocks.js(67,5): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/paste-handler.js(57,9): error TS2554: Expected 3 arguments, but got 2. packages/blocks/src/api/raw-handling/paste-handler.js(58,62): error TS2345: Argument of type '{ inline: boolean; }' is not assignable to parameter of type 'boolean | undefined'. Type '{ inline: boolean; }' is not assignable to type 'true'. packages/blocks/src/api/raw-handling/paste-handler.js(94,73): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. Type 'undefined' is not assignable to type 'boolean'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(13,40): error TS2339: Property 'style' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(19,12): error TS2339: Property 'style' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(45,13): error TS2339: Property 'target' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(45,28): error TS2339: Property 'target' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(46,9): error TS2339: Property 'rel' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(48,9): error TS2339: Property 'removeAttribute' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/phrasing-content-reducer.js(49,9): error TS2339: Property 'removeAttribute' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/shortcode-converter.js(51,32): error TS2339: Property 'content' does not exist on type 'Shortcode'. Property 'content' does not exist on type '{ attrs: ShortcodeAttrs; tag: string; } & { type: "single" | "self-closing"; }'. packages/blocks/src/api/raw-handling/shortcode-converter.js(67,19): error TS2339: Property 'blockName' does not exist on type 'TransformShortcode>'. packages/blocks/src/api/raw-handling/shortcode-converter.js(69,5): error TS2345: Argument of type '{ attributes: any; } | { attributes: any; category: string; deprecated?: readonly BlockDeprecation>[] | undefined; description?: string | undefined; edit?: ComponentClass>, any> | FunctionComponent<...> | undefined; ... 10 more ...; }' is not assignable to parameter of type 'string | Block>'. Type '{ attributes: any; }' is not assignable to type 'string | Block>'. Type '{ attributes: any; }' is missing the following properties from type 'Block>': category, icon, name, save, title packages/blocks/src/api/raw-handling/shortcode-converter.js(70,38): error TS2339: Property 'blockName' does not exist on type 'TransformShortcode>'. packages/blocks/src/api/raw-handling/shortcode-converter.js(73,21): error TS2339: Property 'content' does not exist on type 'Shortcode'. Property 'content' does not exist on type '{ attrs: ShortcodeAttrs; tag: string; } & { type: "single" | "self-closing"; }'. packages/blocks/src/api/raw-handling/special-comment-converter.js(33,7): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/special-comment-converter.js(35,22): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/special-comment-converter.js(44,13): error TS2322: Type 'ChildNode | null' is not assignable to type 'ChildNode'. Type 'null' is not assignable to type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(98,13): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/utils.js(104,26): error TS2339: Property 'hasAttributes' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(205,15): error TS2339: Property 'hasAttributes' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(207,23): error TS2339: Property 'attributes' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(209,13): error TS2339: Property 'removeAttribute' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(216,16): error TS2339: Property 'classList' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(216,34): error TS2339: Property 'classList' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(227,24): error TS2339: Property 'classList' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(229,14): error TS2339: Property 'classList' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(233,19): error TS2339: Property 'classList' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(234,13): error TS2339: Property 'removeAttribute' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(249,37): error TS2339: Property 'querySelector' does not exist on type 'ChildNode'. packages/blocks/src/api/raw-handling/utils.js(256,8): error TS2531: Object is possibly 'null'. packages/blocks/src/api/raw-handling/utils.js(281,55): error TS2339: Property 'nextElementSibling' does not exist on type 'ChildNode'. packages/blocks/src/api/registration.js(107,12): error TS2540: Cannot assign to 'deprecated' because it is a read-only property. packages/blocks/src/api/registration.js(157,39): error TS2345: Argument of type '"search" | "camera" | "microphone" | "clipboard" | "exit" | "hidden" | "button" | "html" | "menu" | "filter" | "marker" | "text" | "update" | "ellipsis" | "layout" | "move" | "sticky" | ... 275 more ... | undefined' is not assignable to parameter of type 'BlockIcon'. Type 'undefined' is not assignable to type 'BlockIcon'. packages/blocks/src/api/registration.js(158,36): error TS2339: Property 'src' does not exist on type 'BlockIcon'. Property 'src' does not exist on type '"search"'. packages/blocks/src/api/serializer.js(83,8): error TS2339: Property 'save' does not exist on type 'Block> | undefined'. packages/blocks/src/api/serializer.js(105,17): error TS2339: Property 'props' does not exist on type 'object'. packages/blocks/src/api/serializer.js(110,41): error TS2339: Property 'props' does not exist on type 'object'. packages/blocks/src/api/serializer.js(111,28): error TS2345: Argument of type 'object' is not assignable to parameter of type 'ReactElement ReactElement Component)> | null) | (new (props: any) => Component)>'. Type '{}' is missing the following properties from type 'ReactElement ReactElement Component)> | null) | (new (props: any) => Component)>': type, props, key packages/blocks/src/api/serializer.js(125,25): error TS4104: The type 'readonly BlockInstance>[]' is 'readonly' and cannot be assigned to the mutable type 'BlockInstance[]'. packages/blocks/src/api/serializer.js(145,41): error TS2345: Argument of type 'Block> | undefined' is not assignable to parameter of type 'string | Block>'. Type 'undefined' is not assignable to type 'string | Block>'. packages/blocks/src/api/serializer.js(294,47): error TS2345: Argument of type 'Block> | undefined' is not assignable to parameter of type 'Block>'. Type 'undefined' is not assignable to type 'Block>'. packages/blocks/src/api/utils.js(55,30): error TS2339: Property 'block' does not exist on type '(block: BlockInstance>) => boolean'. packages/blocks/src/api/utils.js(56,28): error TS2339: Property 'block' does not exist on type '(block: BlockInstance>) => boolean'. packages/blocks/src/api/utils.js(58,28): error TS2339: Property 'block' does not exist on type '(block: BlockInstance>) => boolean'. packages/blocks/src/api/utils.js(61,51): error TS2339: Property 'block' does not exist on type '(block: BlockInstance>) => boolean'. packages/blocks/src/api/utils.js(64,16): error TS2532: Object is possibly 'undefined'. packages/blocks/src/api/utils.js(98,3): error TS2322: Type '{ src: BlockIcon; }' is not assignable to type 'BlockIcon'. Type '{ src: BlockIcon; }' is not assignable to type 'BlockIconNormalized'. Types of property 'src' are incompatible. Type 'BlockIcon' is not assignable to type '"search" | "camera" | "microphone" | "clipboard" | "exit" | "hidden" | "button" | "html" | "menu" | "filter" | "marker" | "text" | "update" | "ellipsis" | "layout" | "move" | "sticky" | ... 273 more ... | FunctionComponent<...>'. Type 'BlockIconNormalized' is not assignable to type '"search" | "camera" | "microphone" | "clipboard" | "exit" | "hidden" | "button" | "html" | "menu" | "filter" | "marker" | "text" | "update" | "ellipsis" | "layout" | "move" | "sticky" | ... 273 more ... | FunctionComponent<...>'. Type 'BlockIconNormalized' is not assignable to type 'FunctionComponent<{}>'. Type 'BlockIconNormalized' provides no match for the signature '(props: { children?: ReactNode; }, context?: any): ReactElement ReactElement Component)> | null) | (new (props: any) => Component<...>)> | null'. packages/blocks/src/api/validation.js(579,22): error TS2339: Property 'selfClosing' does not exist on type 'Token'. Property 'selfClosing' does not exist on type 'EndTag'. packages/blocks/src/api/validation.js(584,30): error TS2339: Property 'tagName' does not exist on type 'Token'. Property 'tagName' does not exist on type 'Chars'. packages/blocks/src/api/validation.js(584,55): error TS2339: Property 'tagName' does not exist on type 'Token'. Property 'tagName' does not exist on type 'Chars'. packages/blocks/src/api/validation.js(673,43): error TS2345: Argument of type 'Block> | undefined' is not assignable to parameter of type 'string | Block>'. Type 'undefined' is not assignable to type 'string | Block>'. packages/blocks/src/api/validation.js(683,4): error TS2532: Object is possibly 'undefined'. packages/blocks/src/store/selectors.js(36,57): error TS2322: Type 'Block> | undefined' is not assignable to type 'Block>'. Type 'undefined' is not assignable to type 'Block>'.TODO items remaining:
valid-jsdocand instead useeslint-plugin-jsdocfor better JSDoc support.@types/wordpress__blocksfor accuracy.How has this been tested?
N/A
Screenshots
N/A
Types of changes
Devops
Checklist:
Of note: The readme parser seems to be broken with the changes I made to the JSDoc for whatever reason. The error message was vague.