Skip to content
New issue

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

The syntax of the output declaration file is incorrect #225

Open
eavidy opened this issue Jun 3, 2024 · 0 comments
Open

The syntax of the output declaration file is incorrect #225

eavidy opened this issue Jun 3, 2024 · 0 comments

Comments

@eavidy
Copy link

eavidy commented Jun 3, 2024

  • 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 git@github.com: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 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant