-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add checker speculation helper, use in overload resolution #57421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
6c2105a
c507e37
eaa6845
d258aa3
fbf8ffe
d75610c
56a2026
6d0dfbb
8a66709
5196f05
0655150
e861368
4b50e12
1beceeb
8605b12
ada8221
e92f50b
dd829c4
fb3cac4
bca2687
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ var use: Overload; | |
use((req, res) => {}); | ||
>use((req, res) => {}) : void | ||
>use : Overload | ||
>(req, res) => {} : (req: any, res: any) => void | ||
>req : any | ||
>res : any | ||
>(req, res) => {} : (req: number, res: number) => void | ||
>req : number | ||
>res : number | ||
|
||
interface Overload { | ||
(handler1: (req1: string) => void): void; | ||
|
@@ -31,11 +31,11 @@ app.use((err: any, req, res, next) => { return; }); | |
>app.use : IRouterHandler<MyApp> & IRouterMatcher<MyApp> | ||
>app : MyApp | ||
>use : IRouterHandler<MyApp> & IRouterMatcher<MyApp> | ||
>(err: any, req, res, next) => { return; } : (err: any, req: any, res: any, next: any) => void | ||
>(err: any, req, res, next) => { return; } : (err: any, req: Request, res: Response, next: NextFunction) => void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously, this'd get |
||
>err : any | ||
>req : any | ||
>res : any | ||
>next : any | ||
>req : Request | ||
>res : Response | ||
>next : NextFunction | ||
|
||
|
||
interface MyApp { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,8 @@ | ||
destructuringTuple.ts(11,7): error TS2461: Type 'number' is not an array type. | ||
destructuringTuple.ts(11,48): error TS2769: No overload matches this call. | ||
Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error. | ||
Type 'never[]' is not assignable to type 'number'. | ||
Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error. | ||
Type 'never[]' is not assignable to type '[]'. | ||
Target allows only 0 element(s) but source may have more. | ||
destructuringTuple.ts(11,60): error TS2769: No overload matches this call. | ||
Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error. | ||
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'. | ||
Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error. | ||
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'. | ||
destructuringTuple.ts(11,7): error TS2461: Type 'unknown' is not an array type. | ||
destructuringTuple.ts(11,48): error TS18046: 'accu' is of type 'unknown'. | ||
|
||
|
||
==== destructuringTuple.ts (3 errors) ==== | ||
==== destructuringTuple.ts (2 errors) ==== | ||
declare var tuple: [boolean, number, ...string[]]; | ||
|
||
const [a, b, c, ...rest] = tuple; | ||
|
@@ -25,22 +15,9 @@ destructuringTuple.ts(11,60): error TS2769: No overload matches this call. | |
|
||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []); | ||
~~~~~~~ | ||
!!! error TS2461: Type 'number' is not an array type. | ||
~~~~~~~~~~~~~~~ | ||
!!! error TS2769: No overload matches this call. | ||
!!! error TS2769: Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error. | ||
!!! error TS2769: Type 'never[]' is not assignable to type 'number'. | ||
!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error. | ||
!!! error TS2769: Type 'never[]' is not assignable to type '[]'. | ||
!!! error TS2769: Target allows only 0 element(s) but source may have more. | ||
!!! related TS6502 lib.es5.d.ts:--:--: The expected type comes from the return type of this signature. | ||
!!! related TS6502 lib.es5.d.ts:--:--: The expected type comes from the return type of this signature. | ||
~~ | ||
!!! error TS2769: No overload matches this call. | ||
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error. | ||
!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'. | ||
!!! error TS2769: Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error. | ||
!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'. | ||
!!! error TS2461: Type 'unknown' is not an array type. | ||
~~~~ | ||
!!! error TS18046: 'accu' is of type 'unknown'. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wishy washy on this one. Previously, we'd fix the first parameter to |
||
|
||
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know if I need to have bothered making the save/restore mechanism for diagnostic collections this externally opaque, since they're
@internal
anyway.