Skip to content

Commit fc3bfbc

Browse files
jrolfsclaude
andcommitted
fix(editor): ship type declarations instead of raw source
@pascal-app/editor exposed only its .tsx source via exports["."] = "./src/index.tsx", so every TypeScript consumer type-checked the editor's whole source tree — surfacing the internal R3F JSX augmentation (declare module 'react/jsx-runtime' in box-select-tool.tsx), which conflicts with React 19 DOM element types and pollutes the global JSX.IntrinsicElements union downstream. Emit declaration-only output to dist/ (tsc -p tsconfig.build.json) and point the `types` export condition at dist/index.d.ts; runtime stays on src for embedders' bundlers. Consumers now resolve the public type surface — the augmentation lives only in box-select-tool's declaration, which nothing in the public type graph imports, so it stops leaking. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 92144b4 commit fc3bfbc

3 files changed

Lines changed: 53 additions & 2 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
"@pascal-app/editor": patch
3+
---
4+
5+
Ship type declarations and resolve them via a `types` export condition.
6+
7+
`@pascal-app/editor` previously exposed only its raw `.tsx` source
8+
(`exports["."] = "./src/index.tsx"`), so every TypeScript consumer
9+
type-checked the editor's entire source tree. That surfaced the editor's
10+
internal R3F JSX augmentation (`declare module 'react/jsx-runtime'` in
11+
`box-select-tool.tsx`) inside consumers' programs, where it both conflicted
12+
with React 19's DOM element types and polluted the global
13+
`JSX.IntrinsicElements` union.
14+
15+
The package now emits declarations to `dist/` (`tsc -p tsconfig.build.json`,
16+
declaration-only — runtime is still served from `src` for embedders' bundlers)
17+
and points the `types` export condition at `dist/index.d.ts`. Consumers now
18+
resolve the editor's public type surface instead of its source; the internal
19+
augmentation lives only in `box-select-tool`'s declaration, which nothing in
20+
the public type graph imports, so it no longer leaks downstream.

packages/editor/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,21 @@
44
"description": "Pascal building editor component",
55
"type": "module",
66
"exports": {
7-
".": "./src/index.tsx",
8-
"./catalog": "./src/components/ui/item-catalog/catalog-items.tsx"
7+
".": {
8+
"types": "./dist/index.d.ts",
9+
"import": "./src/index.tsx",
10+
"default": "./src/index.tsx"
11+
},
12+
"./catalog": {
13+
"types": "./dist/components/ui/item-catalog/catalog-items.d.ts",
14+
"import": "./src/components/ui/item-catalog/catalog-items.tsx",
15+
"default": "./src/components/ui/item-catalog/catalog-items.tsx"
16+
}
917
},
18+
"files": ["dist", "src", "README.md"],
1019
"scripts": {
20+
"build": "tsc -p tsconfig.build.json",
21+
"dev": "tsc -p tsconfig.build.json --watch",
1122
"check-types": "tsc --noEmit"
1223
},
1324
"peerDependencies": {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"declaration": true,
6+
"declarationMap": true,
7+
"emitDeclarationOnly": true,
8+
"outDir": "dist",
9+
"rootDir": "src"
10+
},
11+
"include": ["src"],
12+
"exclude": [
13+
"node_modules",
14+
"dist",
15+
"**/*.test.ts",
16+
"**/*.test.tsx",
17+
"**/__tests__/**",
18+
"**/__bench__/**"
19+
]
20+
}

0 commit comments

Comments
 (0)