Skip to content

Commit

Permalink
chore: add arethetypeswrong checking to use-* react libs
Browse files Browse the repository at this point in the history
Note that these libs had incorrect types according to arethetypeswrong. This must have something to do with the react-library tsconfig not bundling the types together. Rather than investigate, I'm just switching to tsup's `dts: true` type generation which seems to work.
  • Loading branch information
altano committed Sep 1, 2024
1 parent 8575fa0 commit d56ea7b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 32 deletions.
9 changes: 7 additions & 2 deletions packages/build-config/tsup.config.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ export default defineConfig({
// since we're bundling, index is the only entry
entry: ["./src/index.ts"],
format: "esm",
onSuccess: "pnpm build:types",
dts: false,

// Because we're bundling, tsc can't generate types for us, so we use tsup's
// type gen. The downside is that we don't get declaration maps. Unfortunately
// we can't use tsc to ONLY generate declaration maps (and they would be wrong
// because it doesn't work on the bundled file anyway).
dts: true,

clean: true,

platform: "browser",
Expand Down
3 changes: 2 additions & 1 deletion packages/use-element-observer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"scripts": {
"build": "tsup --config build-config/tsup.config.browser.ts",
"build:types": "tsc --project tsconfig.declarations.json",
"check-exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
"dev": "pnpm run build --watch",
"format": "prettier --check src",
Expand Down Expand Up @@ -45,6 +45,7 @@
},
"devDependencies": {
"@altano/tsconfig": "workspace:*",
"@arethetypeswrong/cli": "^0.15.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.2",
"@types/react": "^18.2.64",
Expand Down
9 changes: 0 additions & 9 deletions packages/use-element-observer/tsconfig.declarations.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/use-toc-visible-sections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"scripts": {
"build": "tsup --config build-config/tsup.config.browser.ts",
"build:types": "tsc --project tsconfig.declarations.json",
"check-exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
"dev": "pnpm run build --watch",
"format": "prettier --check src",
Expand Down Expand Up @@ -46,6 +46,7 @@
},
"devDependencies": {
"@altano/tsconfig": "workspace:*",
"@arethetypeswrong/cli": "^0.15.4",
"@playwright/test": "1.40.0",
"@types/node": "^20.11.25",
"@types/react": "^18.2.64",
Expand Down
9 changes: 0 additions & 9 deletions packages/use-toc-visible-sections/tsconfig.declarations.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/use-visible-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"scripts": {
"build": "tsup --config build-config/tsup.config.browser.ts",
"build:types": "tsc --project tsconfig.declarations.json",
"check-exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
"dev": "pnpm run build --watch",
"format": "prettier --check src",
Expand Down Expand Up @@ -47,6 +47,7 @@
},
"devDependencies": {
"@altano/tsconfig": "workspace:*",
"@arethetypeswrong/cli": "^0.15.4",
"@playwright/test": "1.40.0",
"@types/node": "^20.11.25",
"@types/react": "^18.2.64",
Expand Down
9 changes: 0 additions & 9 deletions packages/use-visible-elements/tsconfig.declarations.json

This file was deleted.

9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d56ea7b

Please sign in to comment.