question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate method declarations exists in the emitted .d.ts file of this JS file

See original GitHub issue

Describe the bug

Version: 14.0.0

duplicate code exists in the .d.ts declaration file generated by ts-morph from .js file.

To Reproduce

// .js
export default {
    methods: {
        handleScroll() {}
    }
};
// .d.ts
// handleScroll is duplicate
declare namespace _default {
    namespace methods {
        function handleScroll(): void;
        function handleScroll(): void;
    }
}
export default _default;

Expected behavior no duplicate code

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dsherretcommented, May 21, 2022

@likuner well I won’t be able to fix it because I don’t have time and it’s a bug with the TypeScript compiler. If you need this fixed then you can look into fixing this bug I opened in TS’s repo: https://github.com/microsoft/TypeScript/issues/49200

0reactions
likunercommented, May 21, 2022

Thanks! I can reproduce it. Most likely it is a bug in the ts compiler.

OK, please let me know after the problem is solved, I need it urgently, Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

build mode: generated .d.ts files causing 'Duplicate identifier ...
Today, the only way you get a /// <reference types="node" /> directive out of declaration emit is by inputting one (as the mapping...
Read more >
Typescript does not copy d.ts files to build - Stack Overflow
You are right - declaration:true implies that only for each given .ts file tsc generates and copies a corresponding .d.ts output file to...
Read more >
Documentation - Creating .d.ts Files from .js files - TypeScript
The TSConfig is a jsonc file which configures both your compiler flags, and declare where to find files. In this case, you will...
Read more >
Configuring TypeScript compiler - inDepthDev
TypeScript files are compiled into JavaScript using TypeScript compiler. ... To have the compiler emit .d.ts files, use the declaration option: <>Copy.
Read more >
typescript-cheatsheet - GitHub Pages
js, most tasks are accomplished by loading one or more modules. We could define each module in its own .d.ts file with top-level...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found