-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fast_check): properly handle rest parameters in overloads (#432)
- Loading branch information
1 parent
88a1147
commit 523d1e2
Showing
2 changed files
with
132 additions
and
11 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
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,101 @@ | ||
# https://jsr.io/@scope/a/meta.json | ||
{"versions": { "1.0.0": {} } } | ||
|
||
# https://jsr.io/@scope/a/1.0.0_meta.json | ||
{ "exports": { ".": "./mod.ts" } } | ||
|
||
# https://jsr.io/@scope/a/1.0.0/mod.ts | ||
export class argsToArray { | ||
argsToArray(..._args: string[]): void; | ||
argsToArray(..._args: number[]): void; | ||
argsToArray(..._args: unknown[]): void {} | ||
} | ||
|
||
export function overloadSpread(...args: string[]); | ||
export function overloadSpread(...args: number[]); | ||
export function overloadSpread(...args: unknown[]) { | ||
return args; | ||
} | ||
|
||
export function overloadLast(value: string, ...args: string[]); | ||
export function overloadLast(value: number, ...args: number[]); | ||
export function overloadLast(value: string | number, ...args: unknown[]) { | ||
return args; | ||
} | ||
|
||
# mod.ts | ||
import 'jsr:@scope/a' | ||
|
||
# output | ||
{ | ||
"roots": [ | ||
"file:///mod.ts" | ||
], | ||
"modules": [ | ||
{ | ||
"kind": "esm", | ||
"dependencies": [ | ||
{ | ||
"specifier": "jsr:@scope/a", | ||
"code": { | ||
"specifier": "jsr:@scope/a", | ||
"span": { | ||
"start": { | ||
"line": 0, | ||
"character": 7 | ||
}, | ||
"end": { | ||
"line": 0, | ||
"character": 21 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"size": 22, | ||
"mediaType": "TypeScript", | ||
"specifier": "file:///mod.ts" | ||
}, | ||
{ | ||
"kind": "esm", | ||
"size": 549, | ||
"mediaType": "TypeScript", | ||
"specifier": "https://jsr.io/@scope/a/1.0.0/mod.ts" | ||
} | ||
], | ||
"redirects": { | ||
"jsr:@scope/a": "https://jsr.io/@scope/a/1.0.0/mod.ts" | ||
}, | ||
"packages": { | ||
"@scope/a": "@scope/a@1.0.0" | ||
} | ||
} | ||
|
||
Fast check https://jsr.io/@scope/a/1.0.0/mod.ts: | ||
{} | ||
export class argsToArray { | ||
argsToArray(..._args: string[]): void; | ||
argsToArray(..._args: number[]): void; | ||
argsToArray(...param0?: any): any { | ||
return {} as never; | ||
} | ||
} | ||
export function overloadSpread(...args: string[]); | ||
export function overloadSpread(...args: number[]); | ||
export function overloadSpread(...param0?: any): any { | ||
return {} as never; | ||
} | ||
export function overloadLast(value: string, ...args: string[]); | ||
export function overloadLast(value: number, ...args: number[]); | ||
export function overloadLast(param0?: any, ...param1?: any): any { | ||
return {} as never; | ||
} | ||
--- DTS --- | ||
export declare class argsToArray { | ||
argsToArray(..._args: string[]): void; | ||
argsToArray(..._args: number[]): void; | ||
} | ||
export declare function overloadSpread(...args: string[]); | ||
export declare function overloadSpread(...args: number[]); | ||
export declare function overloadLast(value: string, ...args: string[]); | ||
export declare function overloadLast(value: number, ...args: number[]); |