FlorianRappl / dets

Generate a single declaration file for your TypeScript project. :rocket:
https://piral.io
MIT License
24 stars 5 forks source link

Running "dets" results in a crash #44

Closed wiresnchains closed 1 month ago

wiresnchains commented 1 month ago

Running the following CLI command: dets src/index.ts --name foo --files src/**/*.ts --out dist/index.d.ts Results in the terminal terminating with code 1

My index exports 2 classes from other files, that have a class set as a default export.

wiresnchains commented 1 month ago

It seems that placing semicolons after classes & class methods is the issue.

FlorianRappl commented 1 month ago

I am not sure - can you provide an MWE?

The parsing is done by TypeScript - so as long as TS does not crash we don't have an issue here ;). What we need is a full reproducible incl. the version of TS that you use. In general unknown tokens from TS can cause issues which is why the TS version matters to have a good reproducible.

wiresnchains commented 1 month ago

It's not a major issue, just something I've been using for my old codebase that was crashing.

class Demo {
    private x: number;
    private y: number;

    constructor(x: number, y: number) {
        this.x = x;
        this.y = y;
    }; // placing a semicolon here crashed the declaration compiler

    public getSum() {
        return this.x + this.y;
    }; // here also
}

export { Demo };
FlorianRappl commented 1 month ago

Thanks for the report. I think I can reproduce it. A fix should be out soon.

FlorianRappl commented 1 month ago

Out in 0.16.1.