Skip to content

Commit 1b9f3f7

Browse files
committed
fix: imports from ESM modules cannot find correct type definitions (#23870)
1 parent 8641449 commit 1b9f3f7

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/aws-cdk-lib/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@
407407
},
408408
"exports": {
409409
".": {
410+
"types": "./index.d.ts",
410411
"import": "./index.js",
411412
"require": "./lazy-index.js"
412413
},

tools/@aws-cdk/ubergen/bin/ubergen.ts

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ interface LibraryReference {
4848
}
4949

5050
type Export = string | {
51+
readonly types?: string;
5152
readonly import?: string;
5253
readonly require?: string;
5354
};
@@ -275,6 +276,7 @@ async function prepareSourceFiles(libraries: readonly LibraryReference[], packag
275276
// allowed for this package: we only want to allow the exact import statements that we want to support.
276277
packageJson.exports = {
277278
'.': {
279+
types: './index.d.ts',
278280
import: './index.js',
279281
require: './lazy-index.js',
280282
},

0 commit comments

Comments
 (0)