File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
packages/eslint-plugin/tests/rules Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,27 @@ declare module "foo" {
136
136
` ,
137
137
`
138
138
export default function(foo: number): string[];
139
+ ` ,
140
+ // https://github.com/typescript-eslint/typescript-eslint/issues/740
141
+ `
142
+ function p(key: string): Promise<string | undefined>
143
+ function p(key: string, defaultValue: string): Promise<string>
144
+ function p(key: string, defaultValue?: string): Promise<string | undefined>
145
+ {
146
+ const obj: Record<string, string> = { }
147
+ return obj[key] || defaultValue
148
+ }
149
+ ` ,
150
+ `
151
+ interface I {
152
+ p<T>(x: T): Promise<T>;
153
+ p(x: number): Promise<number>;
154
+ }
155
+ ` ,
156
+ `
157
+ function rest(...xs: number[]): Promise<number[]>;
158
+ function rest(xs: number[], y: string): Promise<string>;
159
+ async function rest(...args: any[], y?: string): Promise<number[] | string> { return y || args }
139
160
` ,
140
161
] ,
141
162
invalid : [
You can’t perform that action at this time.
0 commit comments