-
-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(isolated-declarations): arrow function unions in return signature (
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
crates/oxc_isolated_declarations/tests/fixtures/function-signatures.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// All of these are valid function signatures under isolatedDeclarations | ||
export function A(): void { | ||
return; | ||
} | ||
|
||
export function B(): (() => void) | undefined { | ||
return () => {}; | ||
} | ||
|
||
// There should be no declaration for the implementation signature, just the | ||
// two overloads. | ||
export function C(x: string): void | ||
export function C(x: number): void | ||
export function C(x: string | number): void { | ||
return; | ||
} | ||
|
||
// private, not emitted | ||
function D(a, b): void { | ||
return; | ||
} | ||
function E(a: number, b: string) { | ||
return `${a} ${b}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
crates/oxc_isolated_declarations/tests/snapshots/function-signatures.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
source: crates/oxc_isolated_declarations/tests/mod.rs | ||
input_file: crates/oxc_isolated_declarations/tests/fixtures/function-signatures.ts | ||
--- | ||
``` | ||
==================== .D.TS ==================== | ||
|
||
export declare function A(): void; | ||
export declare function B(): (() => void) | undefined; | ||
export declare function C(x: string): void; | ||
export declare function C(x: number): void; |