Repository: swc-project/swc (rust)

Issue:
Using function overloads reports a "... is defined multiple times" error [SWC 1.2.209]
### Describe the bug

In SWC 1.2.209, an error occurs when using [function overloads in TypeScript](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads).

### Input code

```typescript
function makeDate(timestamp: number): Date;
function makeDate(m: number, d: number, y: number): Date;
function makeDate(mOrTimestamp: number, d?: number, y?: number): Date {
  if (d !== undefined && y !== undefined) {
    return new Date(y, mOrTimestamp, d);
  } else {
    return new Date(mOrTimestamp);
  }
}
```


### Config

```json
{
  "jsc": {
    "parser": {
      "syntax": "typescript"
    }
  }
}
```


### Playground link

https://play.swc.rs/?version=1.2.209&code=H4sIAAAAAAAAA42NQQrCMBBF9znFd1MS6AlaSjfu3XiBaCYQNKOkCSVI726siLUiuBv%2BvP%2B%2BTXyM7sLw%2BkRbHUlG52mI2l8bcPIHCqrB49EK%2B8X6F1PDvM%2F8T3MX9uuhIukXln6lwU0AzkIabLoOiQ1Zx2RQVcifkZpZIFBMgcE0zgaZayyHy6BqCziBzgP96CwLT1pMdyxCm%2Fc2AQAA&config=H4sIAAAAAAAAA6tWyipOVrKqVipILCpOLQKxiivzShIrlKyUSioLUouTizILSpRqa2sB6iQk7CoAAAA%3D

### Expected behavior

No error occurs.

### Actual behavior

When using function overloads within TypeScript code, SWC reports "the name `makeDate` is defined multiple times" error.

### Version

1.2.209

### Additional context

_No response_

Pull request description:
fix(es/lints): allow overload in ts
<!-- Note: CI script will automatically rebase your PR so please do not rebase unless required -->

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->

**Description:**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

**BREAKING CHANGE:**

<!--
If this PR introduces a breaking change, it must contain a notice for it to be included in the CHANGELOG. Add description or remove entirely if not breaking.

You may need to update `MIGRATION.md` for the breaking changes.
-->

**Related issue (if exists):**
closes #5115 

Patch:
diff --git a/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs b/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs
index 5eef2c27fd..7ffbdc4a04 100644
--- a/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs
+++ b/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs
@@ -87,11 +87,16 @@ impl DuplicateBindings {
     fn visit_with_stmt_like<T: StmtLike + VisitWith<Self>>(&mut self, s: &[T]) {
         let mut fn_name = AHashMap::default();
         for s in s {
-            if let Some(Stmt::Decl(Decl::Fn(s))) = s.as_stmt() {
-                if let Some(prev) = fn_name.get(&s.ident.sym) {
-                    emit_error(&s.ident.sym, s.ident.span, *prev)
+            if let Some(Stmt::Decl(Decl::Fn(FnDecl {
+                ident,
+                function: Function { body: Some(_), .. },
+                ..
+            }))) = s.as_stmt()
+            {
+                if let Some(prev) = fn_name.get(&ident.sym) {
+                    emit_error(&ident.sym, ident.span, *prev)
                 } else {
-                    fn_name.insert(s.ident.sym.clone(), s.ident.span);
+                    fn_name.insert(ident.sym.clone(), ident.span);
                 }
             }
 


Test patch:
diff --git a/crates/swc_ecma_lints/tests/pass/issue-5115/1/input.ts b/crates/swc_ecma_lints/tests/pass/issue-5115/1/input.ts
new file mode 100644
index 0000000000..06dce87d4e
--- /dev/null
+++ b/crates/swc_ecma_lints/tests/pass/issue-5115/1/input.ts
@@ -0,0 +1,11 @@
+function makeDate(timestamp: number): Date;
+function makeDate(m: number, d: number, y: number): Date;
+function makeDate(mOrTimestamp: number, d?: number, y?: number): Date {
+  if (d !== undefined && y !== undefined) {
+    return new Date(y, mOrTimestamp, d);
+  } else {
+    return new Date(mOrTimestamp);
+  }
+}
+
+export {}
\ No newline at end of file