mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(isolated-declarations): if declarations is referenced in declare global then keep it (#3982)
close: #3981
This commit is contained in:
parent
211447559b
commit
bd1141da67
3 changed files with 14 additions and 1 deletions
|
|
@ -144,6 +144,7 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
}
|
||||
Declaration::TSModuleDeclaration(decl) => {
|
||||
if decl.kind.is_global() {
|
||||
self.scope.visit_ts_module_declaration(decl);
|
||||
transformed_indexes.push(new_stmts.len());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
function MyFunction() {
|
||||
return 'here is my function'
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
MyFunction: typeof MyFunction
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
|
|
@ -4,5 +4,10 @@ input_file: crates/oxc_isolated_declarations/tests/fixtures/declare-global.ts
|
|||
---
|
||||
==================== .D.TS ====================
|
||||
|
||||
declare global {}
|
||||
declare function MyFunction(): string;
|
||||
declare global {
|
||||
interface Window {
|
||||
MyFunction: typeof MyFunction;
|
||||
}
|
||||
}
|
||||
export {};
|
||||
|
|
|
|||
Loading…
Reference in a new issue