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

Duplicate method declarations in generated declaration file for JS file #49200

Closed
dsherret opened this issue May 21, 2022 · 0 comments · Fixed by #50609
Closed

Duplicate method declarations in generated declaration file for JS file #49200

dsherret opened this issue May 21, 2022 · 0 comments · Fixed by #50609
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Help Wanted You can do this
Milestone

Comments

@dsherret
Copy link
Contributor

Bug Report

TypeScript is producing duplicate methods in the generated declaration file of a JavaScript file.

🔎 Search Terms

emit allowJs duplicate methods

🕗 Version & Regression Information

Tried it in two:

  • 4.8.0-dev.20220521
  • 4.5.5

💻 Code

main.js (not .ts... works fine in .ts):

export default {
  methods: {
      handleScroll() {}
  }
};

tsconfig.json:

{
  "compilerOptions": {
    "target": "es2016",
    "declaration": true,
    "emitDeclarationOnly": true,
    "allowJs": true,
    "module": "commonjs",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}

🙁 Actual behavior

main.d.ts:

declare namespace _default {
    namespace methods {
        function handleScroll(): void;
        function handleScroll(): void;
    }
}
export default _default;

🙂 Expected behavior

declare namespace _default {
    namespace methods {
        function handleScroll(): void;
    }
}
export default _default;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Help Wanted You can do this
Projects
None yet
3 participants