Skip to content

Commit 28a0bc5

Browse files
committed
Allow importing with exports-aware Typescript
Trying to import the library could run into the following issue: error TS7016: Could not find a declaration file for module '@signalapp/sqlcipher'. '.../node_modules/@signalapp/sqlcipher/dist/index.mjs' implicitly has an 'any' type. There are types at '.../node_modules/@signalapp/sqlcipher/dist/lib/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@signalapp/sqlcipher' library may need to update its package.json or typings. The issue comes from mismatch where index.mjs does not automatically map to index.d.ts (it would have to be index.d.mts). The solution is to add types to export. The other "type" key could be removed but is left in for now for compatibility with old tsc versions.
1 parent d2364fa commit 28a0bc5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"module": "dist/index.mjs",
1818
"exports": {
1919
"import": "./dist/index.mjs",
20-
"require": "./dist/index.cjs"
20+
"require": "./dist/index.cjs",
21+
"types": "./dist/lib/index.d.ts"
2122
},
2223
"types": "dist/lib/index.d.ts",
2324
"files": [

0 commit comments

Comments
 (0)