Skip to content

isolatedDeclaration strips module declarations if the file contains imports or exports #4607

@MichaelMitchell-at

Description

@MichaelMitchell-at

Tested version: 0.23.0

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

Expected:

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

Actual:

import "bar";
export {};

Metadata

Metadata

Assignees

Labels

C-bugCategory - Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions