Skip to content

Commit 470cc40

Browse files
committed
test out alias workflow
1 parent c0ec628 commit 470cc40

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

packages/feedback/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@
5252
"build:transpile": "rollup -c rollup.npm.config.mjs",
5353
"build:bundle": "rollup -c rollup.bundle.config.mjs",
5454
"build:dev": "run-p build:transpile build:types",
55-
"build:types": "run-s build:types:core build:types:downlevel",
55+
"build:types": "run-s build:types:core build:types:downlevel build:types:alias",
5656
"build:types:core": "tsc -p tsconfig.types.json",
5757
"build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8",
58+
"build:types:alias": "yarn node ./scripts/add-global-type.js",
5859
"build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch",
5960
"build:dev:watch": "run-p build:transpile:watch build:types:watch",
6061
"build:transpile:watch": "yarn build:transpile --watch",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// preact does not support more modern TypeScript versions, which breaks our users that depend on older
2+
// TypeScript versions. To fix this, we alias preact module to a shim for our <4.9 TS users.
3+
4+
// Path: build/npm/types-ts3.8/global.d.ts
5+
6+
const fs = require('fs');
7+
const path = require('path');
8+
9+
function run() {
10+
fs.copyFileSync(
11+
path.join('scripts', 'global-test.d.ts.tmpl'),
12+
path.join('build', 'npm', 'types-ts3.8', 'global.d.ts'),
13+
);
14+
}
15+
16+
run();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module 'preact' {
2+
export type VNode = any;
3+
export type ComponentChildren = any;
4+
export type ComponentType<T> = any;
5+
export const h: any;
6+
}

0 commit comments

Comments
 (0)