Skip to content

Commit 2f04be2

Browse files
Gozalarvagg
authored andcommitted
fix: type mapping
- modify scripts to use newer tsc --bulid command - generate types on prepare so linking to git dependency works - workaround douple substitution by mapping types/* to itself (see microsoft/TypeScript#41284)
1 parent 0d2ade2 commit 2f04be2

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ package-lock.json
66
node_modules
77
.DS_Store
88
yarn.lock
9+
types

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88
"scripts": {
99
"build": "npm run build:js && npm run build:types",
1010
"build:js": "npm_config_yes=true ipjs build --tests --main",
11-
"build:types": "cp tsconfig.json dist && cp -a src vendor dist/ && cd dist && tsc --emitDeclarationOnly --declarationDir types",
11+
"build:types": "cp tsconfig.json dist && cp -a src vendor dist/ && cd dist && tsc --build",
1212
"build:vendor": "npm run build:vendor:varint && npm run build:vendor:base-x",
1313
"build:vendor:varint": "npx brrp -x varint > vendor/varint.js",
1414
"build:vendor:base-x": "npx brrp -x @multiformats/base-x > vendor/base-x.js",
1515
"publish": "npm_config_yes=true ipjs publish",
1616
"lint": "standard",
17-
"check": "tsc --noEmit --noErrorTruncation",
17+
"check": "tsc --build --noErrorTruncation",
1818
"test:cjs": "npm run build:js && mocha dist/cjs/node-test/test-*.js && npm run test:cjs:browser",
1919
"test:node": "hundreds mocha test/test-*.js",
2020
"test:cjs:browser": "polendina --page --worker --serviceworker --cleanup dist/cjs/browser-test/test-*.js",
2121
"test:ts": "npm run build:types && npm run test --prefix test/ts-use",
2222
"test": "npm run lint && npm run test:node && npm run test:cjs && npm run test:ts",
2323
"test:node-v12": "mocha test/test-*.js && npm run test:cjs",
24-
"coverage": "c8 --reporter=html mocha test/test-*.js && npm_config_yes=true npx st -d coverage -p 8080"
24+
"coverage": "c8 --reporter=html mocha test/test-*.js && npm_config_yes=true npx st -d coverage -p 8080",
25+
"prepare": "tsc --build"
2526
},
2627
"c8": {
2728
"exclude": [
@@ -119,7 +120,10 @@
119120
"homepage": "https://github.com/multiformats/js-multiformats#readme",
120121
"typesVersions": {
121122
"*": {
122-
"multiformats/*": [
123+
"*": [
124+
"types/*"
125+
],
126+
"types/*": [
123127
"types/*"
124128
]
125129
}

test/ts-use/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"compilerOptions": {
33
"strict": true,
4+
"moduleResolution": "node",
45
"noImplicitAny": true,
5-
"skipLibCheck": true
6+
"skipLibCheck": true,
7+
"incremental": true
68
}
79
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"moduleResolution": "node",
2121
"declaration": true,
2222
"declarationMap": true,
23-
"outDir": "dist",
23+
"emitDeclarationOnly": true,
24+
"outDir": "types",
2425
"skipLibCheck": true,
2526
"stripInternal": true,
2627
"resolveJsonModule": true,

0 commit comments

Comments
 (0)