We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export =
When using export = with --dts --no-splitting, the declaration file uses export default instead of export = .
--dts --no-splitting
export default
src/index.ts
function hello(name: string) { console.log(`Hello ${name}`); } export = hello;
package.json
{ "scripts": { "build": "tsup src/index.ts --dts --no-splitting" }, "devDependencies": { "tsup": "^4.11.2", "typescript": "^4.3.4" } }
tsconfig.json
{ "compilerOptions": { "isolatedModules": true, "esModuleInterop": true, "declaration": true, "outDir": "dist", "module": "commonjs" }, "include": [ "src" ] }
dist/index.js
// src/index.ts function hello(name) { console.log(`Hello ${name}`); } module.exports = hello;
dist/index.d.ts
declare function hello(name: string): void; export default hello; // should be export = hello
The text was updated successfully, but these errors were encountered:
I think I spoke to soon actually.
I thought it had to be export = because that's what tsc outputs, but seems Typescript handles this fine when importing it.
tsc
Sorry, something went wrong.
I'm noticing intellisense doesn't actually work when importing the module via CJS require.
But since it's TypeScript, I guess it's reasonable to expect all imports would be ESM import.
Would still be nice to have it be export = for correctness and Intellisense but no longer a blocker for me. Feel free to re-open.
rollup-plugin-dts doesn't support export = pattern If I recall correctly.
module.exports
No branches or pull requests
When using
export =
with--dts --no-splitting
, the declaration file usesexport default
instead ofexport =
.Input
src/index.ts
package.json
tsconfig.json
Output
dist/index.js
dist/index.d.ts
The text was updated successfully, but these errors were encountered: