diff --git a/.eslintrc.js b/.eslintrc.js index 33c845339..609dafb34 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,7 @@ const javascriptSettings = { }; const typescriptSettings = { - files: ['*.ts'], + files: ['*.ts', '*.mts'], parserOptions: { project: './tsconfig.json' }, diff --git a/package.json b/package.json index 057679544..bfba0162b 100644 --- a/package.json +++ b/package.json @@ -33,17 +33,27 @@ "lib/*.js", "esm.mjs", "typings/index.d.ts", + "typings/esm.d.mts", "package-support.json" ], "type": "commonjs", "main": "./index.js", "exports": { ".": { - "types": "./typings/index.d.ts", - "require": "./index.js", - "import": "./esm.mjs" + "require": { + "types": "./typings/index.d.ts", + "default": "./index.js" + }, + "import": { + "types": "./typings/esm.d.mts", + "default": "./esm.mjs" + }, + "default": "./index.js" }, - "./esm.mjs": "./esm.mjs" + "./esm.mjs": { + "types": "./typings/esm.d.mts", + "import": "./esm.mjs" + } }, "devDependencies": { "@types/jest": "^29.2.4", diff --git a/typings/esm.d.mts b/typings/esm.d.mts new file mode 100644 index 000000000..40b0230ed --- /dev/null +++ b/typings/esm.d.mts @@ -0,0 +1,3 @@ +// Just reexport the types from cjs +// This is a bit indirect. There is not an index.js, but TypeScript will look for index.d.ts for types. +export * from './index.js';