mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
This PR implements namespace transform:
Look at this example
```ts
let internal = 0;
export namespace ns {
namespace internal {
export class Foo {}
}
export namespace nested {
export import inner = internal;
}
}
// to
export declare namespace ns {
namespace internal {
class Foo {
}
}
export namespace nested {
export import inner = internal;
}
export {};
}
```
The `let internal = 0` is unexported, and is unreferenced in other types. So we need to remove it.
I refactored `scope` because the previous implementation could not correctly remove unexported and unreferenced declarations.
For example, in this case
```ts
type T = string;
export function foo<T>(): T {
}
// to
type T = string;
export declare function foo<T>(): T;
```
The `type T = string` should be deleted, Because the `T` is not used in the function return type.
|
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| CHANGELOG.md | ||