forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontextualExpressionTypecheckingDoesntBlowStack.types
88 lines (78 loc) · 2.87 KB
/
contextualExpressionTypecheckingDoesntBlowStack.types
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
=== tests/cases/compiler/contextualExpressionTypecheckingDoesntBlowStack.ts ===
// repro for: https://github.com/Microsoft/TypeScript/issues/23661
export interface IValidationError {
message: string;
>message : string
}
export default class Operation {
>Operation : Operation
validateParameters(parameterValues: any) : IValidationError[] | null {
>validateParameters : (parameterValues: any) => IValidationError[] | null
>parameterValues : any
>null : null
let result: IValidationError[] | null = null;
>result : IValidationError[] | null
>null : null
>null : null
for(const parameterLocation of Object.keys(parameterValues)) {
>parameterLocation : string
>Object.keys(parameterValues) : string[]
>Object.keys : { <K extends string>(o: Record<K, any>): K[]; (o: {}): string[]; }
>Object : ObjectConstructor
>keys : { <K extends string>(o: Record<K, any>): K[]; (o: {}): string[]; }
>parameterValues : any
const parameter: any = (this as any).getParameter();;
>parameter : any
>(this as any).getParameter() : any
>(this as any).getParameter : any
>(this as any) : any
>this as any : any
>this : this
>getParameter : any
const values = (this as any).getValues();
>values : any
>(this as any).getValues() : any
>(this as any).getValues : any
>(this as any) : any
>this as any : any
>this : this
>getValues : any
const innerResult = parameter.validate(values[parameter.oaParameter.name]);
>innerResult : any
>parameter.validate(values[parameter.oaParameter.name]) : any
>parameter.validate : any
>parameter : any
>validate : any
>values[parameter.oaParameter.name] : any
>values : any
>parameter.oaParameter.name : any
>parameter.oaParameter : any
>parameter : any
>oaParameter : any
>name : any
if(innerResult && innerResult.length > 0) {
>innerResult && innerResult.length > 0 : boolean
>innerResult : any
>innerResult.length > 0 : boolean
>innerResult.length : any
>innerResult : any
>length : any
>0 : 0
// Commenting out this line will fix the problem.
result = (result || []).concat(innerResult);
>result = (result || []).concat(innerResult) : IValidationError[]
>result : IValidationError[] | null
>(result || []).concat(innerResult) : IValidationError[]
>(result || []).concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; }
>(result || []) : IValidationError[]
>result || [] : IValidationError[]
>result : IValidationError[] | null
>[] : never[]
>concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; }
>innerResult : any
}
}
return result;
>result : IValidationError[] | null
}
}