Skip to content

Commit

Permalink
Fix type declaration location when importing JSON (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaran16 authored Sep 3, 2020
1 parent e87395d commit cc34619
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onfido/api",
"version": "1.5.1",
"version": "1.5.2",
"description": "Node.js library for the Onfido API",
"keywords": [
"onfido",
Expand Down
2 changes: 2 additions & 0 deletions src/ignoreJson.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Using resolveJsonModule with TypeScript and importing package.json causes issues because it causes rootDir to change to . instead of ./src, which means generated type declarations get output in dist/src rather than just dist. Since rollup inserts JSON directly we can just ignore JSON modules in TypeScript.
declare module "*.json";
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["./**/*"],
"compilerOptions": {
"baseUrl": "../",
"resolveJsonModule": true,
"paths": {
"onfido-node": ["src/index"]
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"resolveJsonModule": true
"rootDir": "src"
},
"include": ["src/**/*"]
}

0 comments on commit cc34619

Please sign in to comment.