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

Using rollupTypes generates invalid declaration file #222

Closed
3 tasks done
NoelDeMartin opened this issue Jun 9, 2023 · 0 comments
Closed
3 tasks done

Using rollupTypes generates invalid declaration file #222

NoelDeMartin opened this issue Jun 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@NoelDeMartin
Copy link

Describe the bug

The declaration files are generated normally without using the rollupTypes option, but if I set it to true the generated files are not valid. In particular, they generate the following:

declare interface Constructor<T = Object> {
    new (...args: any[]): T;
}

declare const _default: ServiceConstructor<;

export declare class MyService extends _default {
}

declare class Service {
}

declare type ServiceConstructor<T extends Service = Service> = Constructor<T> & typeof Service;

export { }

Notice how the line declare const _default: ServiceConstructor<; is missing the closing > and the generic value.

I know these classes and types may seem a bit weird without much context, but that's the simplest thing I've been able to do whilst reproducing the issue.

Reproduction

https://github.com/NoelDeMartin/vite-sandbox/tree/lib-dts

Steps to reproduce

Run npm install followed by npm run build, then look at the generated file dist/my-lib.d.ts.

System Info

System:
    OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 7.16 GB / 15.48 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chromium: 113.0.5672.126
    Firefox: 113.0.2
  npmPackages:
    vite: ^4.3.9 => 4.3.9 
    vite-plugin-dts: ^2.3.0 => 2.3.0

Validations

@qmhc qmhc added the bug Something isn't working label Jun 30, 2023
@qmhc qmhc closed this as completed in 99105b0 Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants