Skip to content

Commit db5c55f

Browse files
authored
Widgets: Add TypeScript project config (WordPress#78467)
* add TypeScript project config for widgets/ resolve @wordpress/*, CSS module imports, and JSX in widget .tsx files * document widget package.json in wp-build README list it in the widgets Structure tree as an optional npm dependencies manifest * add widgets to root tsconfig references ensures CI type-checks widgets via tsgo --build
1 parent c89576d commit db5c55f

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/wp-build/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ widgets/
549549
widget.ts # Runtime schema entry point (optional)
550550
render.tsx # UI component entry point (optional)
551551
render.scss # Optional styles (bundled inline when imported from render.tsx)
552+
package.json # Optional npm dependencies manifest
552553
```
553554

554555
### Why two entries?

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
{ "path": "storybook" },
9494
{ "path": "test/e2e" },
9595
{ "path": "test/storybook-playwright" },
96-
{ "path": "test/performance" }
96+
{ "path": "test/performance" },
97+
{ "path": "widgets" }
9798
],
9899
"files": []
99100
}

widgets/tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig.json",
3+
"extends": "../tsconfig.base.json",
4+
"compilerOptions": {
5+
"jsx": "react-jsx",
6+
"rootDir": ".",
7+
"noEmit": true,
8+
"emitDeclarationOnly": false,
9+
"composite": false,
10+
"types": [ "style-imports" ]
11+
},
12+
"include": [ "**/*.ts", "**/*.tsx" ],
13+
"exclude": [ "**/test/**", "build", "node_modules" ]
14+
}

0 commit comments

Comments
 (0)