diff --git a/examples/playground/src/CurrencyCombobox.tsx b/examples/playground/src/CurrencyCombobox.tsx index becef0d..717c4db 100644 --- a/examples/playground/src/CurrencyCombobox.tsx +++ b/examples/playground/src/CurrencyCombobox.tsx @@ -4,7 +4,7 @@ import { CurrencyPreset, searchCurrencies, toFlagEmoji -} from 'react-financial-input'; +} from 'react-financial-input/currency'; /* Copied verbatim from the library's own story, save for the import above. diff --git a/examples/playground/src/styles.css.d.ts b/examples/playground/src/styles.css.d.ts new file mode 100644 index 0000000..3d95a48 --- /dev/null +++ b/examples/playground/src/styles.css.d.ts @@ -0,0 +1,3 @@ +// A side-effect import of the opt-in stylesheet. TypeScript has no idea what a +// .css file is, and there is nothing to type — this just says it exists. +declare module 'react-financial-input/styles.css'; diff --git a/package.json b/package.json index 026c472..072e9c7 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ ], "scripts": { "build": "vite build && tsc -p ./tsconfig-build.json && node scripts/fixDeclarationImports.mjs", - "typecheck": "tsc --noEmit -p ./tsconfig.json", + "typecheck": "tsc --noEmit -p ./tsconfig.json && tsc --noEmit -p ./tsconfig-examples.json", "test": "vitest run", "test:watch": "vitest", "coverage": "vitest run --coverage", diff --git a/tsconfig-examples.json b/tsconfig-examples.json new file mode 100644 index 0000000..58fd517 --- /dev/null +++ b/tsconfig-examples.json @@ -0,0 +1,33 @@ +/* + The examples, typechecked against the library source. + + examples/playground has its own tsconfig for anyone who installs and runs + it, but nothing in CI installed it — so when the currency helpers moved to + their own entry point, App.tsx was updated by hand and CurrencyCombobox.tsx + was missed. The playground on StackBlitz went to a white screen with + "does not provide an export named 'searchCurrencies'", and nothing failed. + + Mapping the package name onto lib/ means the examples are checked against + the entry points as they are now, on every run, with no install step. + */ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "strict": true, + "skipLibCheck": true, + "noEmit": true, + "baseUrl": ".", + "paths": { + "react-financial-input": ["./lib/index.ts"], + "react-financial-input/parse": ["./lib/parse.ts"], + "react-financial-input/currency": ["./lib/currency.ts"], + "react-financial-input/events": ["./lib/events.ts"] + } + }, + "include": ["examples"], + "exclude": ["**/node_modules", "**/dist"] +}