Add Typescript type declarations for js packages
This commit is contained in:
parent
f7ecb97a52
commit
6f5ada8748
|
@ -19,6 +19,7 @@
|
||||||
},
|
},
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"module": "build-module/index.js",
|
"module": "build-module/index.js",
|
||||||
|
"types": "build-types",
|
||||||
"react-native": "src/index",
|
"react-native": "src/index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@woocommerce/date": "workspace:*",
|
"@woocommerce/date": "workspace:*",
|
||||||
|
|
|
@ -17,7 +17,9 @@ import type { NOTES_STORE_NAME } from './notes';
|
||||||
import type { REPORTS_STORE_NAME } from './reports';
|
import type { REPORTS_STORE_NAME } from './reports';
|
||||||
import type { ITEMS_STORE_NAME } from './items';
|
import type { ITEMS_STORE_NAME } from './items';
|
||||||
import type { COUNTRIES_STORE_NAME } from './countries';
|
import type { COUNTRIES_STORE_NAME } from './countries';
|
||||||
|
import type { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||||
import { OnboardingSelectors } from './onboarding/selectors';
|
import { OnboardingSelectors } from './onboarding/selectors';
|
||||||
|
|
||||||
import { WPDataSelectors } from './types';
|
import { WPDataSelectors } from './types';
|
||||||
import { PluginSelectors } from './plugins/selectors';
|
import { PluginSelectors } from './plugins/selectors';
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ export { NAVIGATION_STORE_NAME } from './navigation';
|
||||||
export { withNavigationHydration } from './navigation/with-navigation-hydration';
|
export { withNavigationHydration } from './navigation/with-navigation-hydration';
|
||||||
|
|
||||||
export { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
export { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||||
|
import { PaymentSelectors } from './payment-gateways/selectors';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getFilterQuery,
|
getFilterQuery,
|
||||||
|
@ -102,7 +105,8 @@ export type WCDataStoreName =
|
||||||
| typeof NOTES_STORE_NAME
|
| typeof NOTES_STORE_NAME
|
||||||
| typeof REPORTS_STORE_NAME
|
| typeof REPORTS_STORE_NAME
|
||||||
| typeof ITEMS_STORE_NAME
|
| typeof ITEMS_STORE_NAME
|
||||||
| typeof COUNTRIES_STORE_NAME;
|
| typeof COUNTRIES_STORE_NAME
|
||||||
|
| typeof PAYMENT_GATEWAYS_STORE_NAME;
|
||||||
|
|
||||||
// As we add types to all the package selectors we can fill out these unknown types with real ones. See one
|
// As we add types to all the package selectors we can fill out these unknown types with real ones. See one
|
||||||
// of the already typed selectors for an example of how you can do this.
|
// of the already typed selectors for an example of how you can do this.
|
||||||
|
@ -114,6 +118,8 @@ export type WCSelectorType< T > = T extends typeof REVIEWS_STORE_NAME
|
||||||
? PluginSelectors
|
? PluginSelectors
|
||||||
: T extends typeof ONBOARDING_STORE_NAME
|
: T extends typeof ONBOARDING_STORE_NAME
|
||||||
? OnboardingSelectors
|
? OnboardingSelectors
|
||||||
|
: T extends typeof PAYMENT_GATEWAYS_STORE_NAME
|
||||||
|
? PaymentSelectors
|
||||||
: T extends typeof USER_STORE_NAME
|
: T extends typeof USER_STORE_NAME
|
||||||
? WPDataSelectors
|
? WPDataSelectors
|
||||||
: T extends typeof OPTIONS_STORE_NAME
|
: T extends typeof OPTIONS_STORE_NAME
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"extends": "../tsconfig",
|
"extends": "../tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "build-module"
|
"outDir": "build-module",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declarationDir": "./build-types"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
},
|
},
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"module": "build-module/index.js",
|
"module": "build-module/index.js",
|
||||||
|
"types": "build-types",
|
||||||
"react-native": "src/index",
|
"react-native": "src/index",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"build-style/**",
|
"build-style/**",
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "build-module",
|
"outDir": "build-module",
|
||||||
"target": "es2019"
|
"target": "es2019",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declarationDir": "./build-types"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
},
|
},
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"module": "build-module/index.js",
|
"module": "build-module/index.js",
|
||||||
|
"types": "build-types",
|
||||||
"react-native": "src/index",
|
"react-native": "src/index",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"extends": "../tsconfig",
|
"extends": "../tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "build-module"
|
"outDir": "build-module",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declarationDir": "./build-types"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
},
|
},
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"module": "build-module/index.js",
|
"module": "build-module/index.js",
|
||||||
|
"types": "build-types",
|
||||||
"react-native": "src/index",
|
"react-native": "src/index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@wordpress/api-fetch": "^6.0.1",
|
"@wordpress/api-fetch": "^6.0.1",
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"extends": "../tsconfig",
|
"extends": "../tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "build-module"
|
"outDir": "build-module",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declarationDir": "./build-types"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
},
|
},
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"module": "build-module/index.js",
|
"module": "build-module/index.js",
|
||||||
|
"types": "build-types",
|
||||||
"react-native": "src/index",
|
"react-native": "src/index",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"extends": "../tsconfig",
|
"extends": "../tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "build-module"
|
"outDir": "build-module",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declarationDir": "./build-types"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue