Skip to content

Commit 6c61a03

Browse files
[Feature:Developer] Add type declarations for typescript (#473)
1 parent 1e3f84f commit 6c61a03

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ shared/pdf_viewer.css
1515
shared/pdf_viewer.js
1616
shared/pdf_viewer.js.map
1717
shared/cmaps/
18+
types/

package-lock.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
"version": "2.4.0",
44
"description": "Annotation layer for pdf.js",
55
"main": "index.js",
6+
"types": "types",
67
"scripts": {
78
"test": "karma start --single-run",
89
"start": "./scripts/web",
910
"lint": "./node_modules/.bin/eslint .",
1011
"startindocker": "./scripts/web-docker",
1112
"build": "webpack && MINIFY=1 webpack",
1213
"codecov": "codecov",
13-
"prepublishOnly": "npm run build"
14+
"prepublishOnly": "npm run build && npm run types",
15+
"types": "tsc"
1416
},
1517
"repository": {
1618
"type": "git",
@@ -58,6 +60,7 @@
5860
"sinon": "^9.0.2",
5961
"sinon-chai": "^3.3.0",
6062
"terser-webpack-plugin": "^4.2.3",
63+
"typescript": "^4.5.5",
6164
"webpack": "^4.34.0",
6265
"webpack-cli": "^4.7.2",
6366
"webpack-dev-server": "^3.7.2"
@@ -69,6 +72,7 @@
6972
"dist",
7073
"src",
7174
"index.js",
75+
"types",
7276
"LICENSE.md",
7377
"README.md",
7478
"webpack.config.js"

tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"include": ["src/**/*.js", "index.js"],
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"declaration": true,
6+
"emitDeclarationOnly": true,
7+
"declarationMap": true,
8+
"outDir": "types"
9+
}
10+
}

0 commit comments

Comments
 (0)