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

imports inside module declaration are moved outside, which can break types #318

Closed
2 of 3 tasks
floriancargoet opened this issue Apr 9, 2024 · 1 comment
Closed
2 of 3 tasks
Labels
bug Something isn't working

Comments

@floriancargoet
Copy link

floriancargoet commented Apr 9, 2024

Describe the bug

Since 3.8, this ambient declaration in foo.d.ts :

declare module "foo" {
  import { Bar } from "bar";
  type Foo = {
    bar: Bar
  };
  export = Foo;
}

is transformed into:

import { Bar } from "bar"; // This import moved

declare module "foo" {
  type Foo = {
    bar: Bar
  };
  export = Foo;
}

This top-level import turns an ambient module into a standard module and it breaks the global declare module "foo".

Reproduction

.

Steps to reproduce

No response

System Info

System:
    OS: macOS 13.6.6
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
    Memory: 40.82 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.15.5 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
    bun: 1.1.0 - ~/.bun/bin/bun
    Watchman: 2023.12.04.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 123.0.6312.107
    Safari: 17.4.1
  npmPackages:
    @vitejs/plugin-react: 4.2.1 => 4.2.1
    vite: 5.2.8 => 5.2.8
    vite-plugin-dts: 3.8.1 => 3.8.1

Validations

@qmhc qmhc added the bug Something isn't working label Apr 9, 2024
@qmhc qmhc closed this as completed in 1d65015 Apr 11, 2024
@floriancargoet
Copy link
Author

Thanks! I'll test it in the next release.

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