oxc icon indicating copy to clipboard operation
oxc copied to clipboard

isolatedDeclaration strips module declaration if the same module is imported in the same file

Open MichaelMitchell-at opened this issue 6 months ago • 1 comments

Tested version: 0.23.0

import {} from 'foo';
declare module 'foo' {
    interface Foo {}
    const foo = 42;
}
require('oxc-transform').isolatedDeclaration('hello.ts', `
  import "foo";
  declare module "foo" {
    interface Foo {}
    const foo = 42;
  }
`)
{ sourceText: 'import "foo";\nexport {};\n', errors: [] }

Expected:

import "foo";
declare module "foo" {
  interface Foo {}
  const foo = 42;
}

Actual:

import "foo";
export {};

MichaelMitchell-at avatar Aug 02 '24 07:08 MichaelMitchell-at