Skip to content

Commit

Permalink
fix: include type definitions in "exports" (#3201)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 authored May 16, 2023
1 parent 3a0c5f9 commit 3a76506
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"declaration": true,
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./dist/tolgee.cjs.js",
"import": "./dist/tolgee.esm.mjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/format-icu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./dist/tolgee-format-icu.cjs.js",
"import": "./dist/tolgee-format-icu.esm.mjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/i18next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
},
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./dist/tolgee-i18next.cjs.js",
"import": "./dist/tolgee-i18next.esm.mjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./dist/tolgee-react.cjs.js",
"import": "./dist/tolgee-react.esm.mjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
},
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./dist/tolgee-vue.cjs.js",
"import": "./dist/tolgee-vue.esm.mjs"
},
Expand Down
6 changes: 6 additions & 0 deletions scripts/packages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ const checkPackage = (filePath) => {
f.exports?.['./package.json'] === './package.json',
'package.json in exports'
);
if (typeof f.exports?.['.'] === 'object') {
assertExpr(
f.exports?.['.']?.['types'] !== undefined,
"has type definitions for 'exports' field"
);
}
}
assertFileExists(folder, f.main, 'main');
assertFileExists(folder, f.module, 'module');
Expand Down

0 comments on commit 3a76506

Please sign in to comment.