You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tests/baselines/reference/regexpExecAndMatchTypeUsages(strict=true).errors.txt
+17-6
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,32 @@
1
1
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(3,5): error TS2532: Object is possibly 'undefined'.
2
-
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(6,5): error TS2532: Object is possibly 'undefined'.
2
+
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(4,5): error TS18048: 'matchResult.index' is possibly 'undefined'.
3
+
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(5,5): error TS18048: 'matchResult.input' is possibly 'undefined'.
4
+
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(6,5): error TS18048: 'matchResult.groups' is possibly 'undefined'.
3
5
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(6,5): error TS2532: Object is possibly 'undefined'.
4
6
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(7,5): error TS2412: Type 'undefined' is not assignable to type '{ [key: string]: string; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target.
5
7
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(10,5): error TS2532: Object is possibly 'undefined'.
6
-
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(13,5): error TS2532: Object is possibly 'undefined'.
8
+
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(13,5): error TS18048: 'execResult.groups' is possibly 'undefined'.
7
9
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(13,5): error TS2532: Object is possibly 'undefined'.
8
10
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(14,5): error TS2412: Type 'undefined' is not assignable to type '{ [key: string]: string; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target.
11
+
tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(20,9): error TS2375: Type 'RegExpMatchArray' is not assignable to type 'RegExpExecArray' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
12
+
Property 'index' is optional in type 'RegExpMatchArray' but required in type 'RegExpExecArray'.
export function foo(matchResult: RegExpMatchArray, execResult: RegExpExecArray) {
13
17
matchResult[0].length;
14
18
matchResult[999].length;
15
19
~~~~~~~~~~~~~~~~
16
20
!!! error TS2532: Object is possibly 'undefined'.
17
21
matchResult.index + 0;
22
+
~~~~~~~~~~~~~~~~~
23
+
!!! error TS18048: 'matchResult.index' is possibly 'undefined'.
18
24
matchResult.input.length;
25
+
~~~~~~~~~~~~~~~~~
26
+
!!! error TS18048: 'matchResult.input' is possibly 'undefined'.
19
27
matchResult.groups["someVariable"].length;
20
28
~~~~~~~~~~~~~~~~~~
21
-
!!! error TS2532: Object is possibly 'undefined'.
29
+
!!! error TS18048: 'matchResult.groups' is possibly 'undefined'.
22
30
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
31
!!! error TS2532: Object is possibly 'undefined'.
24
32
matchResult.groups = undefined;
@@ -33,7 +41,7 @@ tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(14,5): error TS2412: Type '
33
41
execResult.input.length;
34
42
execResult.groups["someVariable"].length;
35
43
~~~~~~~~~~~~~~~~~
36
-
!!! error TS2532: Object is possibly 'undefined'.
44
+
!!! error TS18048: 'execResult.groups' is possibly 'undefined'.
37
45
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
46
!!! error TS2532: Object is possibly 'undefined'.
39
47
execResult.groups = undefined;
@@ -45,6 +53,9 @@ tests/cases/compiler/regexpExecAndMatchTypeUsages.ts(14,5): error TS2412: Type '
45
53
}
46
54
else {
47
55
execResult = matchResult
56
+
~~~~~~~~~~
57
+
!!! error TS2375: Type 'RegExpMatchArray' is not assignable to type 'RegExpExecArray' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
58
+
!!! error TS2375: Property 'index' is optional in type 'RegExpMatchArray' but required in type 'RegExpExecArray'.
0 commit comments