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

Double comments in delcaration file #170

Open
Gu-Miao opened this issue Mar 4, 2022 · 1 comment
Open

Double comments in delcaration file #170

Gu-Miao opened this issue Mar 4, 2022 · 1 comment

Comments

@Gu-Miao
Copy link

Gu-Miao commented Mar 4, 2022

  • Version: 2.0.5
  • Rollup Version: 2.69.0
  • Operating System and version (if applicable): Windows 10
  • Node Version (if applicable): 16.13.2

Reproduction

Here is a simple example.

Core code are shown below.

// src/index.ts
class Test {
  a: number
  b: number
  constructor() {
    this.a = 1
    this.b = 2
  }
  /**
   * C function
   * @param d Some d
   * @param e Some e
   */
  c(d, e) {
    this.a = d + e
  }
}

export default Test
// rollup.config.js
import path from 'path'
import pkg from './package.json'

import clear from 'rollup-plugin-clear'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import ts from 'rollup-plugin-ts'

/** @type import('rollup').RollupOptions */
const config = {
  input: path.join(__dirname, 'src/index.ts'),
  output: [
    {
      file: pkg.module,
      format: 'esm',
      exports: 'auto',
    },
  ],
  plugins: [
    clear({
      targets: ['dist'],
    }),
    resolve(),
    commonjs(),
    ts(),
  ],

  external: 'cesium',
}

export default config
// tsconfig.json
{
  "include": ["src/*"],
  "compilerOptions": {
    "outDir": "dist",
    "target": "ES5",
    "lib": ["ESNext", "DOM"],
    "declaration": true,
    "removeComments": false
  }
}
// dist/index.d.ts
declare class Test {
    a: number;
    b: number;
    constructor();
    /**
     * C function
     * @param d Some d
     * @param e Some e
     */
    /**
     * C function
     * @param d Some d
     * @param e Some e
     */
    c(d: any, e: any): void;
}
export { Test as default };

Expected Behavior

No needless comment.

Actual Behavior

Same two comments for one function.

@Gu-Miao
Copy link
Author

Gu-Miao commented Aug 18, 2022

Is there any solution? The error also occur with latest version rollup-plugin-ts@3.0.2.

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