diff --git a/.gitignore b/.gitignore index 1a7baacb..29669c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -79,4 +79,3 @@ dist # IDE .idea -/*.d.ts diff --git a/package.json b/package.json index 15d70bd6..8960da23 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "types": "index.d.ts", "exports": { ".": { "require": "./dist/index.js", @@ -50,9 +50,16 @@ "./*": "./*" }, "files": [ - "dist", - "*.d.ts" + "dist" ], + "typesVersions": { + "*": { + "*": [ + "./dist/*", + "./*" + ] + } + }, "scripts": { "build": "tsup", "dev": "tsup --watch src", diff --git a/scripts/postbuild.ts b/scripts/postbuild.ts index 3e295667..a21e5441 100644 --- a/scripts/postbuild.ts +++ b/scripts/postbuild.ts @@ -16,9 +16,6 @@ async function run() { let code = await fs.readFile(file, 'utf8') code += 'if (module.exports.default) module.exports = module.exports.default;' await fs.writeFile(file, code) - // generate submodule .d.ts redirecting - const name = basename(file, '.js') - await fs.writeFile(`${name}.d.ts`, `export { default } from './dist/${name}'\n`) } }