Skip to content

Commit

Permalink
fix(es/lints): Correct the false positive error of TS2309 (#9635)
Browse files Browse the repository at this point in the history
**Related issue:**

- Closes #9632
  • Loading branch information
magic-akari authored Oct 12, 2024
1 parent f2be26e commit f74c1f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/wicked-windows-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc_core: patch
swc_ecma_lints: patch
---

fix(es/lints): Correct the false positive error of TS2309
4 changes: 3 additions & 1 deletion crates/swc_ecma_lints/src/rules/duplicate_exports.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::hash_map::Entry;
use std::{collections::hash_map::Entry, mem};

use swc_atoms::JsWord;
use swc_common::{collections::AHashMap, errors::HANDLER, Span};
Expand Down Expand Up @@ -82,7 +82,9 @@ impl Visit for DuplicateExports {

fn visit_ts_module_decl(&mut self, d: &TsModuleDecl) {
if !d.declare {
let old = mem::take(self);
d.visit_children_with(self);
*self = old;
}
}

Expand Down
9 changes: 9 additions & 0 deletions crates/swc_ecma_lints/tests/pass/issue-9632/1/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as meta from "./meta.js";

function nameof(obj: unknown) { }

namespace nameof {
export import version = meta.version;
}

export = nameof;

0 comments on commit f74c1f3

Please sign in to comment.