diff --git a/plugins/woocommerce-blocks/.github/monitor-typescript-errors/index.js b/plugins/woocommerce-blocks/.github/monitor-typescript-errors/index.js index dd5b322ec67..3d029cea328 100644 --- a/plugins/woocommerce-blocks/.github/monitor-typescript-errors/index.js +++ b/plugins/woocommerce-blocks/.github/monitor-typescript-errors/index.js @@ -51,12 +51,14 @@ const runner = async () => { '' : '🎉 🎉 This PR does not introduce new TS errors.' ); - await octokit.rest.issues.createComment( { - owner, - repo, - issue_number: payload.pull_request.number, - body: message, - } ); + if ( process.env[ 'CURRENT_BRANCH' ] !== 'trunk' ) { + await octokit.rest.issues.createComment( { + owner, + repo, + issue_number: payload.pull_request.number, + body: message, + } ); + } if ( process.env[ 'CURRENT_BRANCH' ] === 'trunk' ) { try { diff --git a/plugins/woocommerce-blocks/checkstyle.xml b/plugins/woocommerce-blocks/checkstyle.xml index 8c2009e05a6..f794cc7b3b3 100644 --- a/plugins/woocommerce-blocks/checkstyle.xml +++ b/plugins/woocommerce-blocks/checkstyle.xml @@ -215,14 +215,14 @@ No index signature with a parameter of type 'string' was found on type 'Object'." source="TS7053" /> - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -463,9 +272,9 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -651,55 +608,90 @@ Type 'Object' is not assignable to type 'AnyAction | Generator<any, any, unknown>'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" source="TS2322" /> - - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -710,56 +702,84 @@ - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -777,271 +797,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1118,7 +884,8 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1406,65 +1454,90 @@ - - - - - + + + + - + + + + - - + + + - + + + + - - - - - - + + + + + + + - + Argument of type '{ apiVersion: number; name: string; title: string; icon: { src: JSX.Element; }; keywords: string[]; description: string; usesContext: string[]; parent: string[]; textdomain: string; attributes: { showProductLink: { ...; }; ... 4 more ...; isDescendentOfQueryLoop: { ...; }; }; ... 15 more ...; merge?: ((attributes: {...' is not assignable to parameter of type 'BlockConfiguration<{}>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Type '{ apiVersion: number; name: string; title: string; icon: { src: JSX.Element; }; keywords: string[]; description: string; usesContext: string[]; parent: string[]; textdomain: string; attributes: { showProductLink: { ...; }; ... 4 more ...; isDescendentOfQueryLoop: { ...; }; }; ... 15 more ...; merge?: ((attributes: {...' is not assignable to type 'Partial<Omit<Block<{}>, "icon">>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Types of property 'edit' are incompatible. + Type '({ attributes, setAttributes, context }: { attributes: any; setAttributes: any; context: any; }) => Element' is not assignable to type 'ComponentType<BlockEditProps<{}>> | undefined'. + Type '({ attributes, setAttributes, context }: { attributes: any; setAttributes: any; context: any; }) => Element' is not assignable to type 'FunctionComponent<BlockEditProps<{}>>'. + Types of parameters '__0' and 'props' are incompatible. + Property 'context' is missing in type 'BlockEditProps<{}> & { children?: ReactNode; }' but required in type '{ attributes: any; setAttributes: any; context: any; }'." source="TS2769" /> - - - - - + + - + + + - + Argument of type '{ apiVersion: number; title: string; description: string; ancestor: string[]; usesContext: string[]; icon: { src: JSX.Element; }; attributes: { productId: { type: string; default: number; }; isDescendentOfQueryLoop: { ...; }; }; ... 19 more ...; merge?: ((attributes: {}, attributesToMerge: {}) => Partial<...>) | und...' is not assignable to parameter of type 'BlockConfiguration<{}>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Type '{ apiVersion: number; title: string; description: string; ancestor: string[]; usesContext: string[]; icon: { src: JSX.Element; }; attributes: { productId: { type: string; default: number; }; isDescendentOfQueryLoop: { ...; }; }; ... 19 more ...; merge?: ((attributes: {}, attributesToMerge: {}) => Partial<...>) | und...' is not assignable to type 'Partial<Omit<Block<{}>, "icon">>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Types of property 'edit' are incompatible. + Type '({ attributes, setAttributes, context }: { attributes: any; setAttributes: any; context: any; }) => Element' is not assignable to type 'ComponentType<BlockEditProps<{}>> | undefined'. + Type '({ attributes, setAttributes, context }: { attributes: any; setAttributes: any; context: any; }) => Element' is not assignable to type 'FunctionComponent<BlockEditProps<{}>>'. + Types of parameters '__0' and 'props' are incompatible. + Property 'context' is missing in type 'BlockEditProps<{}> & { children?: ReactNode; }' but required in type '{ attributes: any; setAttributes: any; context: any; }'." source="TS2769" /> @@ -1476,20 +1549,18 @@ Type 'string' is not assignable to type 'Pick<Block<{}>, "title" | "category" | "attributes">'. Overload 2 of 2, '(name: string, settings: BlockConfiguration<{}>): Block<{}> | undefined', gave the following error. Argument of type '{ apiVersion: number; title: string; description: string; icon: { src: JSX.Element; }; attributes: { productId: { type: string; default: number; }; }; supports: { color?: { text: boolean; background: boolean; link: boolean; }; typography?: { ...; }; __experimentalSelector?: string; }; ... 19 more ...; merge?: ((attr...' is not assignable to parameter of type 'BlockConfiguration<{}>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'supports' are incompatible. - Type '{ color?: { text: boolean; background: boolean; link: boolean; }; typography?: { fontSize: boolean; }; __experimentalSelector?: string; }' has no properties in common with type 'BlockSupports'." source="TS2769" /> - - - + Type '{ apiVersion: number; title: string; description: string; icon: { src: JSX.Element; }; attributes: { productId: { type: string; default: number; }; }; supports: { color?: { text: boolean; background: boolean; link: boolean; }; typography?: { ...; }; __experimentalSelector?: string; }; ... 19 more ...; merge?: ((attr...' is not assignable to type 'Partial<Omit<Block<{}>, "icon">>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + The types of 'supports.color.text' are incompatible between these types. + Type 'boolean' is not assignable to type 'string'." source="TS2769" /> - - - - + - - + + @@ -1516,23 +1589,23 @@ - - - - - - - + + + + + + + - - - - + + + + - - + + @@ -1541,14 +1614,10 @@ - - - - - - - - + + @@ -1569,20 +1638,15 @@ Type 'undefined' is not assignable to type 'string'." source="TS2375" /> - + - @@ -1594,8 +1658,8 @@ - + - - - + - - - - - - - + - + @@ -1706,12 +1759,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - + + + + + + + + + + - - - + + - - - + + - - - - + + - - - - - - - + + + + - - - + + + + + - - - - - - + + @@ -1991,49 +1997,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -2087,11 +2094,11 @@ - - - - - + + + + + @@ -2139,47 +2146,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2262,9 +2228,9 @@ - - - + + + @@ -2275,70 +2241,80 @@ + + + - - + + - - - - + Argument of type '{ name: string; version: string; title: string; description: string; category: string; keywords: string[]; supports: { html: boolean; multiple: boolean; inserter: boolean; color: { text: boolean; background: boolean; }; lock: boolean; }; attributes: { ...; }; textdomain: string; apiVersion: number; $schema: string; }' is not assignable to parameter of type 'string'." source="TS2769" /> + + + - - - - - + + - + - - - - + Argument of type '{ name: string; version: string; title: string; description: string; category: string; keywords: string[]; supports: { html: boolean; color: { text: boolean; background: boolean; }; inserter: boolean; lock: boolean; }; ... 4 more ...; $schema: string; }' is not assignable to parameter of type 'string'." source="TS2769" /> + + + + + + + + + + + - - - - - - - - - + + + + + + + + - - - - @@ -2362,69 +2338,263 @@ + + + + + + + + + + + + + + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + - - + - + Type 'string[]' is not assignable to type 'readonly BlockAlignment[]'. + Type 'string' is not assignable to type 'BlockAlignment'." source="TS2322" /> - - + + - + - - - - - - - - - - - - + + + + + + + + + + - - - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + + + - - - - + + + + + @@ -2593,25 +2799,50 @@ - - - + + - - + + + + + + - + + + + @@ -2625,10 +2856,34 @@ Overload 2 of 2, '(props: PropsWithChildren<Props>, context?: any): ReactElement<any, any> | Component<Props, any, any> | null', gave the following error. Type '{ className: string; label: Element; onClick: () => Window | null; }[]' is not assignable to type 'readonly Action[]'." source="TS2769" /> + + + - - + + + + + + + - - + + + + + + + + + + + + + + @@ -2652,17 +2951,82 @@ - - + + + + + + + + + + + + + + + + + + + + + + + - - + - + Type '{ children?: ReactNode; } | RefAttributes<Component<unknown, any, any>>' is not assignable to type '(Omit<{ text: string; checkbox: boolean; instanceId: string; className?: string; }, "instanceId"> & RefAttributes<Component<Omit<{ text: string; checkbox: boolean; instanceId: string; className?: string; }, "instanceId">, any, any>>) | (Omit<...> & { ...; })'. + Type '{ children?: ReactNode; }' is not assignable to type '(Omit<{ text: string; checkbox: boolean; instanceId: string; className?: string; }, "instanceId"> & RefAttributes<Component<Omit<{ text: string; checkbox: boolean; instanceId: string; className?: string; }, "instanceId">, any, any>>) | (Omit<...> & { ...; })'. + Type '{ children?: ReactNode; }' is not assignable to type 'Omit<{ text: string; checkbox: boolean; instanceId: string; className?: string; }, "instanceId"> & { children?: ReactNode; }'. + Type '{ children?: ReactNode; }' is missing the following properties from type 'Omit<{ text: string; checkbox: boolean; instanceId: string; className?: string; }, "instanceId">': checkbox, text" source="TS2322" /> - + @@ -2809,11 +3176,14 @@ - - + + - + + + + @@ -2831,6 +3201,22 @@ + + + + + + @@ -2853,16 +3239,47 @@ Type 'undefined' is not assignable to type 'number'." source="TS2322" /> - + + + - - + + + + + + + + + + + + + + + + - - + @@ -2977,14 +3394,18 @@ - - + + Type 'Readonly<{}>' is missing the following properties from type 'Attributes': addToCartBehaviour, hasHiddenPrice" source="TS2322" /> + + + + + - - - - - - - - - - - + + + + + + + - - + + - - - - + Argument of type '{ name: string; version: string; title: string; description: string; category: string; keywords: string[]; supports: { html: boolean; multiple: boolean; color: { text: boolean; background: boolean; }; inserter: boolean; lock: boolean; }; ... 4 more ...; $schema: string; }' is not assignable to parameter of type 'string'." source="TS2769" /> @@ -3138,19 +3551,32 @@ - - + + + + + - - - - + Argument of type '{ name: string; title: string; category: string; description: string; keywords: string[]; supports: { align: string[]; html: boolean; color: { background: boolean; link: boolean; }; typography: { fontSize: boolean; lineHeight: boolean; }; }; ... 4 more ...; $schema: string; }' is not assignable to parameter of type 'BlockConfiguration<{ align: unknown; hasCount: unknown; hasImage: unknown; hasEmpty: unknown; isDropdown: unknown; isHierarchical: unknown; }>'. + Type '{ name: string; title: string; category: string; description: string; keywords: string[]; supports: { align: string[]; html: boolean; color: { background: boolean; link: boolean; }; typography: { fontSize: boolean; lineHeight: boolean; }; }; ... 4 more ...; $schema: string; }' is not assignable to type 'Partial<Omit<Block<{ align: unknown; hasCount: unknown; hasImage: unknown; hasEmpty: unknown; isDropdown: unknown; isHierarchical: unknown; }>, "icon">>'. + The types of 'attributes["align"]' are incompatible between these types. + Type '{ type: string; }' is not assignable to type 'BlockAttribute<unknown>'. + Type '{ type: string; }' is missing the following properties from type 'Query<unknown>': source, selector, query + Overload 2 of 2, '(name: string, settings: BlockConfiguration<{}>): Block<{}> | undefined', gave the following error. + Argument of type '{ name: string; title: string; category: string; description: string; keywords: string[]; supports: { align: string[]; html: boolean; color: { background: boolean; link: boolean; }; typography: { fontSize: boolean; lineHeight: boolean; }; }; ... 4 more ...; $schema: string; }' is not assignable to parameter of type 'string'." source="TS2769" /> + + + + + + + + + + + + + + + + + + + + + + - - + - - + - - - - + + + @@ -3304,38 +3747,46 @@ - + + + - + - - + + + + + - - - + + + + @@ -3447,10 +3909,14 @@ - + Type 'string' is not assignable to type 'Pick<Block<{ categoryIds: unknown; showProductName: unknown; editMode: unknown; imageType: unknown; orderby: unknown; reviewsOnLoadMore: unknown; reviewsOnPageLoad: unknown; showLoadMore: unknown; showOrderby: unknown; showReviewDate: unknown; showReviewerName: unknown; showReviewImage: unknown; showReviewRating: un...'. + Overload 2 of 2, '(name: string, settings: BlockConfiguration<{ categoryIds: unknown; showProductName: unknown; editMode: unknown; imageType: unknown; orderby: unknown; reviewsOnLoadMore: unknown; reviewsOnPageLoad: unknown; showLoadMore: unknown; showOrderby: unknown; showReviewDate: unknown; showReviewerName: unknown; showReviewImage: unknown; showReviewRating: unknown; showReviewContent: unknown; previewReviews: unknown; }>): Block<...> | undefined', gave the following error. + Type '{ categoryIds: { type: "array"; default: never[]; }; showProductName: { type: "boolean"; default: true; }; editMode: { type: string; default: boolean; }; imageType: { type: string; default: string; }; orderby: { ...; }; ... 9 more ...; previewReviews: { ...; }; }' is not assignable to type '{ readonly categoryIds: BlockAttribute<unknown>; readonly showProductName: BlockAttribute<unknown>; readonly editMode: BlockAttribute<unknown>; readonly imageType: BlockAttribute<...>; ... 10 more ...; readonly previewReviews: BlockAttribute<...>; }'. + Types of property 'editMode' are incompatible. + Type '{ type: string; default: boolean; }' is not assignable to type 'BlockAttribute<unknown>'." source="TS2769" /> @@ -3475,16 +3941,18 @@ Type 'ComponentClass<{ error: any; getProduct: any; isLoading: any; product: any; }, any>' is missing the following properties from type 'ReactElementLike': type, props, key" source="TS2322" /> - + Type 'string' is not assignable to type 'Pick<Block<{ productId: unknown; editMode: unknown; imageType: unknown; orderby: unknown; reviewsOnLoadMore: unknown; reviewsOnPageLoad: unknown; showLoadMore: unknown; showOrderby: unknown; showReviewDate: unknown; showReviewerName: unknown; showReviewImage: unknown; showReviewRating: unknown; showReviewContent: un...'. + Overload 2 of 2, '(name: string, settings: BlockConfiguration<{ productId: unknown; editMode: unknown; imageType: unknown; orderby: unknown; reviewsOnLoadMore: unknown; reviewsOnPageLoad: unknown; showLoadMore: unknown; showOrderby: unknown; showReviewDate: unknown; showReviewerName: unknown; showReviewImage: unknown; showReviewRating: unknown; showReviewContent: unknown; previewReviews: unknown; }>): Block<...> | undefined', gave the following error. + Type '{ productId: { type: "number"; }; editMode: { type: string; default: boolean; }; imageType: { type: string; default: string; }; orderby: { type: string; default: string; }; reviewsOnLoadMore: { type: string; default: number; }; ... 8 more ...; previewReviews: { ...; }; }' is not assignable to type '{ readonly productId: BlockAttribute<unknown>; readonly editMode: BlockAttribute<unknown>; readonly imageType: BlockAttribute<unknown>; readonly orderby: BlockAttribute<unknown>; ... 9 more ...; readonly previewReviews: BlockAttribute<...>; }'. + Types of property 'editMode' are incompatible. + Type '{ type: string; default: boolean; }' is not assignable to type 'BlockAttribute<unknown>'." source="TS2769" /> - - + @@ -3503,8 +3971,6 @@ - @@ -3525,14 +3991,14 @@ - + Argument of type '{ name: string; version: string; title: string; description: string; category: string; keywords: string[]; supports: { html: boolean; multiple: boolean; color: { link: boolean; __experimentalDefaultControls: { ...; }; }; inserter: boolean; lock: boolean; }; ... 4 more ...; $schema: string; }' is not assignable to parameter of type 'string'." source="TS2769" /> @@ -3544,15 +4010,18 @@ - - - - - - - - + + + + + + + + + + + @@ -3633,6 +4102,27 @@ + + + + + + + + + + + + + + + + + + + @@ -3692,24 +4182,28 @@ Type '{ id: number; name: string; parent: number; }' is missing the following properties from type 'SearchListItemType': value, count, children, breadcrumbs" source="TS2345" /> - - - - - - - - + + + + + + - - - - - - - + + + + + + + + + @@ -3888,14 +4382,14 @@ Type 'Record<string, unknown>' is not assignable to type 'boolean'." source="TS2345" /> - - - - + + + + - - + + @@ -3908,6 +4402,9 @@ Property 'images' is missing in type '{}' but required in type '{ images: any[]; }'." source="TS2345" /> + + +