woocommerce/plugins/woocommerce-blocks/tsconfig.base.json

75 lines
2.8 KiB
JSON
Raw Normal View History

Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) * add typescript support * Add type declarations for Cart and CartResponse interfaces * make sure we’re resolving .ts files as well as .js files on imports * add more types * type the cart data store * Apply suggestions from code review (implement .tsx in configs) Co-authored-by: Jon Surrell <jon.surrell@automattic.com> * remove global fetchMock declaration and directly import where used. * rename type * remove named action types and just infer by returning action creator values as const * use interface instead of type * rename * renames * create CartAction type as union of action creator returned types and implement in reducer * remove unused imports * refresh package-lock after rebase * Add base TS config that projects will inherit from * Add tsconfig for assets/js/data project * Ignore TS error on cart store registration We will address this in cooldown when we have time to investigate further * Add tsc to build step to catch TypeScript errors * add a separate command for tsc and tweak build command to use * restore checkJs and allowJs values in config and remove ts check from build command * Add ts:check-all command * Add TypeScript checking workflows * Change triggers for TypeScript workflow * Use npm ci instead of npm install * Remove ts:check-all from TypeScript workflow * Remove TS Check GitHub workflow * Remove type-defs dir from TS include, and remove ts:check-all script We no longer need the ts:check-all script because ts:check will do this for us, the old ts:check did nothing and did not work. * fix coupon loading issues * include .ts files only from type-defs folder Co-authored-by: Jon Surrell <jon.surrell@automattic.com> Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-02-24 01:36:24 +00:00
{
"exclude": [ "node_modules" ],
"compilerOptions": {
"outDir": "./build",
"sourceMap": true,
"baseUrl": ".",
"module": "esnext",
"emitDeclarationOnly": true,
"esModuleInterop": true,
"exactOptionalPropertyTypes": true,
"resolveJsonModule": true,
"jsx": "preserve",
"target": "esnext",
"allowJs": true,
"moduleResolution": "node",
"lib": [ "dom", "esnext" ],
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"allowSyntheticDefaultImports": true,
"composite": true,
"rootDir": ".",
"typeRoots": [ "./node_modules/@types" ],
"types": [ "jest", "jquery" ],
"paths": {
"@woocommerce/atomic-blocks": [ "assets/js/base/atomic/blocks" ],
"@woocommerce/atomic-blocks/*": [
"assets/js/base/atomic/blocks/*"
],
"@woocommerce/atomic-utils": [ "assets/js/atomic/utils" ],
"@woocommerce/base-components/*": [ "assets/js/base/components/*" ],
"@woocommerce/base-context": [ "assets/js/base/context" ],
"@woocommerce/base-context/*": [ "assets/js/base/context/*" ],
"@woocommerce/base-context/hooks": [
"assets/js/base/context/hooks"
],
"@woocommerce/base-context/components": [
"assets/js/base/context/components"
],
"@woocommerce/base-hocs/*": [ "assets/js/base/hocs/*" ],
"@woocommerce/base-hooks": [ "assets/js/base/hooks" ],
"@woocommerce/interactivity": [ "assets/js/interactivity" ],
"@woocommerce/interactivity/*": [ "assets/js/interactivity/*" ],
"@woocommerce/base-utils": [ "assets/js/base/utils" ],
"@woocommerce/base-utils/*": [ "assets/js/base/utils/*" ],
Add Product Query Support for Atomic Rating Block (https://github.com/woocommerce/woocommerce-blocks/pull/7352) * Add PQ support for client-side. Set up the block for PQ support and add necessary adjustments for the editor. Will address dynamic save functionality in a following commit. * Add dynamic render function for PQ support. * Add dynamic render callback for SSR. * Remove client-side Save function. * Add PQ Context interface to shared type defs. * Convert all block JS files to TS. * Remove commented import from block file. * Add typecasting to block function params. As a workaround, added a general Record type but left a TODO to revisit the proper object, as there is a mismatch in the shape of the default object property types and the actual types. * Update inserter behavior. Allows for the ability to add the rating block from in the inserter (as long as it's an inner block of the listed parents in the config). Also disables the placeholder product selector from being rendered unnecessarily (i.e., when the context ID is present). * Update parent inner blocks config. Reassign parent array to ancestor array which allows for blocks to be included with more flexibility - i.e., added within groups that are children of the ancestor block. * Add productID to rating Attributes interface. * TS type casting and import adustments. Some adjustments to utilize types that we already have available, along with some syntax adjustments and more sensible import tweaks. * Update type-casting to use ProductResponseItem Instead of using the generic Record, we can utilize the ProductResponseItem interface and set an omission for the average_rating property until that is corrected to properly reflect the API response. * Add alias to blocks dir for imports. Allows us to use exports from the blocks dir as "external" imports. This way we do not need to write long, relative import paths (which can be fragile in the long run).
2022-10-31 18:56:17 +00:00
"@woocommerce/blocks/*": [ "assets/js/blocks/*" ],
"@woocommerce/editor-components/*": [
"assets/js/editor-components/*"
],
"@woocommerce/block-data": [ "assets/js/data" ],
"@woocommerce/block-hocs": [ "assets/js/hocs" ],
"@woocommerce/blocks-registry": [ "assets/js/blocks-registry" ],
"@woocommerce/blocks-checkout": [ "packages/checkout" ],
"@woocommerce/blocks-components": [ "packages/components" ],
"@woocommerce/interactivity-components/*": [
"packages/interactivity-components/*"
],
"@woocommerce/price-format": [ "packages/prices" ],
"@woocommerce/block-settings": [ "assets/js/settings/blocks" ],
"@woocommerce/icons": [ "assets/js/icons" ],
"@woocommerce/resource-previews": [ "assets/js/previews" ],
"@woocommerce/settings": [ "assets/js/settings/shared" ],
"@woocommerce/shared-context": [ "assets/js/shared/context" ],
"@woocommerce/shared-hocs": [ "assets/js/shared/hocs" ],
"@woocommerce/type-defs/*": [ "assets/js/types/type-defs/*" ],
"@woocommerce/types": [ "assets/js/types" ],
"@woocommerce/storybook-controls": [ "storybook/custom-controls" ],
"@woocommerce/utils": [ "assets/js/utils" ],
"@woocommerce/e2e-utils": [ "tests/e2e/utils" ],
"@woocommerce/templates/*": [ "assets/js/templates/*" ]
}
Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) * add typescript support * Add type declarations for Cart and CartResponse interfaces * make sure we’re resolving .ts files as well as .js files on imports * add more types * type the cart data store * Apply suggestions from code review (implement .tsx in configs) Co-authored-by: Jon Surrell <jon.surrell@automattic.com> * remove global fetchMock declaration and directly import where used. * rename type * remove named action types and just infer by returning action creator values as const * use interface instead of type * rename * renames * create CartAction type as union of action creator returned types and implement in reducer * remove unused imports * refresh package-lock after rebase * Add base TS config that projects will inherit from * Add tsconfig for assets/js/data project * Ignore TS error on cart store registration We will address this in cooldown when we have time to investigate further * Add tsc to build step to catch TypeScript errors * add a separate command for tsc and tweak build command to use * restore checkJs and allowJs values in config and remove ts check from build command * Add ts:check-all command * Add TypeScript checking workflows * Change triggers for TypeScript workflow * Use npm ci instead of npm install * Remove ts:check-all from TypeScript workflow * Remove TS Check GitHub workflow * Remove type-defs dir from TS include, and remove ts:check-all script We no longer need the ts:check-all script because ts:check will do this for us, the old ts:check did nothing and did not work. * fix coupon loading issues * include .ts files only from type-defs folder Co-authored-by: Jon Surrell <jon.surrell@automattic.com> Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-02-24 01:36:24 +00:00
}
}