rollup-plugin-ts
rollup-plugin-ts copied to clipboard
The syntax of the output declaration file is incorrect
- Version: 3.4.5
- Rollup Version: 4.17.2
- Operating System and version (if applicable): Mac OS
- Node Version (if applicable): 20.14.0
- Does it work with
tsc(if applicable): yes
Reproduction
Repo: https://github.com/eavidy/test_case/tree/rollup-plugin-ts
git clone -b rollup-plugin-ts [email protected]:eavidy/test_case.git
package.json
{
"name": "tess",
"version": "1.0.0",
"type": "module",
"devDependencies": {
"rollup": "^4.17.2",
"rollup-plugin-ts": "^3.4.5",
"tslib": "^2.6.2",
"typescript": "^5.4.5"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"lib": ["ESNext"],
"strict": true,
"declaration": true
},
"exclude": ["node_modules", "dist"]
}
rollup.config.js
//@ts-check
import { defineConfig } from "rollup";
import tsPlugin from "rollup-plugin-ts";
export default defineConfig({
input: ["./src/mod.ts"],
output: {
dir: "dist",
},
plugins: [tsPlugin({})],
});
src/mod.ts
export * from "./sub.js";
src/sub.ts
export function array() {}
array.function = 1;
run pnpm rollup -c
Expected Behavior
The output declaration file is correct
Actual Behavior
A declaration file with syntax errors was output (Contains incorrect characters: "generated@68")
declare function array(): void;
declare namespace array {
var generated@68: number;
export { generated@68 as function };
}
export { array };