Skip to content

Commit 168d430

Browse files
committed
feat: Eliminate typings folder in favor of per-target types
Took some doing since there's no nice way in TS of omitting comments from the resulting JS files but keeping them in the TS files. See microsoft/TypeScript#14619 for the relevant issue discussing this. Fixes MichalLytek#1442
1 parent c6c5cf7 commit 168d430

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

package.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,18 @@
3939
"exports": {
4040
".": {
4141
"require": "./build/cjs/index.js",
42-
"import": "./build/esm/index.js",
43-
"types": "./build/typings/index.d.ts"
42+
"import": "./build/esm/index.js"
4443
}
4544
},
4645
"main": "./build/cjs/index.js",
4746
"module": "./build/esm/index.js",
48-
"types": "./build/typings/index.d.ts",
4947
"files": [
5048
"./build"
5149
],
5250
"scripts": {
5351
"prebuild": "npm run clean && npm run check:version",
54-
"build": "npx tsc --build ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.typings.json",
55-
"postbuild": "npx shx rm ./build/typings/browser-shim.d.ts && npx shx cp ./src/browser-shim.ts ./build/typings && npx ts-node ./scripts/package.json.ts",
52+
"build": "npx tsc --build ./tsconfig.cjs.json ./tsconfig.cjs.d.json ./tsconfig.esm.json ./tsconfig.esm.d.json",
53+
"postbuild": "npx shx rm ./build/*/browser-shim.d.ts && npx shx cp ./src/browser-shim.ts ./build/cjs && npx shx cp ./src/browser-shim.ts ./build/esm && npx ts-node ./scripts/package.json.ts",
5654
"prebuild:benchmarks": "npm run clean",
5755
"build:benchmarks": "npx tsc --project ./benchmarks/tsconfig.json",
5856
"build:examples": "npm run --prefix ./examples build",
@@ -65,9 +63,7 @@
6563
"check:type": "npx npm-run-all --npm-path npm \"check:type:*\"",
6664
"check:type:cjs": "npx tsc --project ./tsconfig.cjs.json --noEmit",
6765
"check:type:esm": "npx tsc --project ./tsconfig.esm.json --noEmit",
68-
"check:type:typings": "npx tsc --project ./tsconfig.typings.json --noEmit --emitDeclarationOnly false",
6966
"check:type:benchmarks": "npx tsc --project ./benchmarks/tsconfig.json --noEmit",
70-
"precheck:type:examples": "npx tsc --project ./tsconfig.typings.json",
7167
"check:type:examples": "npx tsc --project ./examples/tsconfig.json --noEmit",
7268
"check:type:scripts": "npx tsc --project ./scripts/tsconfig.json --noEmit",
7369
"check:version": "npx ts-node ./scripts/version.ts",

tsconfig.cjs.d.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./tsconfig.cjs.json",
3+
"compilerOptions": {
4+
// See https://github.com/webstrand/typescript-remove-comments-not-from-declarations for the source of inspiration.
5+
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
8+
"removeComments": false,
9+
10+
// performance enhancement
11+
"disableSolutionSearching": true,
12+
"skipLibCheck": true,
13+
"skipDefaultLibCheck": true
14+
}
15+
}

tsconfig.esm.d.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./tsconfig.esm.json",
3+
"compilerOptions": {
4+
// See https://github.com/webstrand/typescript-remove-comments-not-from-declarations for the source of inspiration.
5+
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
8+
"removeComments": false,
9+
10+
// performance enhancement
11+
"disableSolutionSearching": true,
12+
"skipLibCheck": true,
13+
"skipDefaultLibCheck": true
14+
}
15+
}

tsconfig.typings.json

-9
This file was deleted.

0 commit comments

Comments
 (0)