File: contextualTypingOfTooShortOverloads.types

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (143 lines) | stat: -rw-r--r-- 3,358 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
=== tests/cases/compiler/contextualTypingOfTooShortOverloads.ts ===
// small repro from #11875
var use: Overload;
>use : Overload
>Overload : Overload

use((req, res) => {});
>use((req, res) => {}) : void
>use : Overload
>(req, res) => {} : (req: any, res: any) => void
>req : any
>res : any

interface Overload {
>Overload : Overload

    (handler1: (req1: string) => void): void;
>handler1 : (req1: string) => void
>req1 : string

    (handler2: (req2: number, res2: number) => void): void;
>handler2 : (req2: number, res2: number) => void
>req2 : number
>res2 : number
}
// larger repro from #11875
let app: MyApp;
>app : MyApp
>MyApp : MyApp

app.use((err: any, req, res, next) => { return; });
>app.use((err: any, req, res, next) => { return; }) : MyApp
>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 : any
>res : any
>next : any


interface MyApp {
>MyApp : MyApp

    use: IRouterHandler<this> & IRouterMatcher<this>;
>use : IRouterHandler<this> & IRouterMatcher<this>
>IRouterHandler : IRouterHandler<T>
>IRouterMatcher : IRouterMatcher<T>
}

interface IRouterHandler<T> {
>IRouterHandler : IRouterHandler<T>
>T : T

    (...handlers: RequestHandler[]): T;
>handlers : RequestHandler[]
>RequestHandler : RequestHandler
>T : T

    (...handlers: RequestHandlerParams[]): T;
>handlers : RequestHandlerParams[]
>RequestHandlerParams : RequestHandlerParams
>T : T
}

interface IRouterMatcher<T> {
>IRouterMatcher : IRouterMatcher<T>
>T : T

    (path: PathParams, ...handlers: RequestHandler[]): T;
>path : PathParams
>PathParams : PathParams
>handlers : RequestHandler[]
>RequestHandler : RequestHandler
>T : T

    (path: PathParams, ...handlers: RequestHandlerParams[]): T;
>path : PathParams
>PathParams : PathParams
>handlers : RequestHandlerParams[]
>RequestHandlerParams : RequestHandlerParams
>T : T
}

type PathParams = string | RegExp | (string | RegExp)[];
>PathParams : PathParams
>RegExp : RegExp
>RegExp : RegExp

type RequestHandlerParams = RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[];
>RequestHandlerParams : RequestHandlerParams
>RequestHandler : RequestHandler
>ErrorRequestHandler : ErrorRequestHandler
>RequestHandler : RequestHandler
>ErrorRequestHandler : ErrorRequestHandler

interface RequestHandler {
>RequestHandler : RequestHandler

    (req: Request, res: Response, next: NextFunction): any;
>req : Request
>Request : Request
>res : Response
>Response : Response
>next : NextFunction
>NextFunction : NextFunction
}

interface ErrorRequestHandler {
>ErrorRequestHandler : ErrorRequestHandler

    (err: any, req: Request, res: Response, next: NextFunction): any;
>err : any
>req : Request
>Request : Request
>res : Response
>Response : Response
>next : NextFunction
>NextFunction : NextFunction
}

interface Request {
>Request : Request

    method: string;
>method : string
}

interface Response {
>Response : Response

    statusCode: number;
>statusCode : number
}

interface NextFunction {
>NextFunction : NextFunction

    (err?: any): void;
>err : any
}