Skip to content

Commit 29cbded

Browse files
committed
Add JSDoc based types
1 parent bcc093b commit 29cbded

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
*.d.ts
23
*.log
34
coverage/
45
node_modules/

build.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async function main() {
2727
// eslint-disable-next-line no-await-in-loop
2828
const input = (await import('./' + fp)).cuss
2929
const keys = Object.keys(input).sort()
30+
/** @type {Record<string, number>} */
3031
const output = {}
3132
let offset = -1
3233

package.json

+19-1
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,19 @@
2525
"main": "index.js",
2626
"files": [
2727
"index.js",
28+
"index.d.ts",
2829
"ar-latn.js",
30+
"ar-latn.d.ts",
2931
"es.js",
32+
"es.d.ts",
3033
"fr.js",
34+
"fr.d.ts",
3135
"it.js",
36+
"it.d.ts",
3237
"pt-br.js",
33-
"pt-pt.js"
38+
"pt-br.d.ts",
39+
"pt-pt.js",
40+
"pt-pt.d.ts"
3441
],
3542
"exports": {
3643
".": "./index.js",
@@ -48,14 +55,20 @@
4855
"./pt-pt.js": "./pt-pt.js"
4956
},
5057
"devDependencies": {
58+
"@types/tape": "^4.0.0",
5159
"c8": "^7.0.0",
5260
"prettier": "^2.0.0",
5361
"remark-cli": "^9.0.0",
5462
"remark-preset-wooorm": "^8.0.0",
63+
"rimraf": "^3.0.0",
5564
"tape": "^5.0.0",
65+
"type-coverage": "^2.0.0",
66+
"typescript": "^4.0.0",
5667
"xo": "^0.39.0"
5768
},
5869
"scripts": {
70+
"prepack": "npm run build && npm run format",
71+
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
5972
"generate": "node build",
6073
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
6174
"test-api": "node test.js",
@@ -77,5 +90,10 @@
7790
"plugins": [
7891
"preset-wooorm"
7992
]
93+
},
94+
"typeCoverage": {
95+
"atLeast": 100,
96+
"detail": true,
97+
"strict": true
8098
}
8199
}

tsconfig.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"include": ["*.js"],
3+
"compilerOptions": {
4+
"target": "ES2020",
5+
"lib": ["ES2020"],
6+
"module": "ES2020",
7+
"moduleResolution": "node",
8+
"allowJs": true,
9+
"checkJs": true,
10+
"declaration": true,
11+
"emitDeclarationOnly": true,
12+
"allowSyntheticDefaultImports": true,
13+
"skipLibCheck": true,
14+
"strict": true
15+
}
16+
}

0 commit comments

Comments
 (0)