Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,11 @@ declare class RegExp {
* @param string The String object or string literal on which to perform the search.
*/
exec(string: string): RegExp$matchResult | null;
/**
* Escapes any potential regex syntax characters in a string, and returns a new string that can be safely used as a literal
* pattern for the RegExp() constructor.
*/
static escape(string: string): string;
/**
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
* The characters in this string are sequenced and concatenated in the following order:
Expand Down
44 changes: 22 additions & 22 deletions tests/async/async.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ References:
async.js:9:30
9| async function f1(): Promise<boolean> {
^^^^^^^ [2]
<BUILTINS>/core.js:2187:24
2187| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:2192:24
2192| declare class Promise<+R = mixed> {
^ [3]


Expand All @@ -31,8 +31,8 @@ References:
async.js:28:48
28| async function f4(p: Promise<number>): Promise<boolean> {
^^^^^^^ [2]
<BUILTINS>/core.js:2187:24
2187| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:2192:24
2192| declare class Promise<+R = mixed> {
^ [3]


Expand Down Expand Up @@ -99,8 +99,8 @@ undefined in type argument `R` [2]. [incompatible-type]
^^^^^^ [1]

References:
<BUILTINS>/core.js:2187:24
2187| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:2192:24
2192| declare class Promise<+R = mixed> {
^ [2]


Expand Down Expand Up @@ -142,8 +142,8 @@ References:
async_return_void.js:1:32
1| async function foo1(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:2187:24
2187| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:2192:24
2192| declare class Promise<+R = mixed> {
^ [3]


Expand All @@ -160,8 +160,8 @@ References:
async_return_void.js:5:32
5| async function foo2(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:2187:24
2187| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:2192:24
2192| declare class Promise<+R = mixed> {
^ [3]


Expand All @@ -181,8 +181,8 @@ References:
async_return_void.js:9:32
9| async function foo3(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:2187:24
2187| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:2192:24
2192| declare class Promise<+R = mixed> {
^ [3]


Expand Down Expand Up @@ -220,11 +220,11 @@ string [2] in type argument `Yield` [3]. [incompatible-type]
^^^^^^ [1]

References:
<BUILTINS>/core.js:2250:58
2250| T extends $ReadOnlyArray<mixed> ? {[K in keyof T]: Awaited<T[K]>} :
<BUILTINS>/core.js:2255:58
2255| T extends $ReadOnlyArray<mixed> ? {[K in keyof T]: Awaited<T[K]>} :
^^^^^^^^^^^^^ [2]
<BUILTINS>/core.js:1968:27
1968| interface AsyncGenerator<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1973:27
1973| interface AsyncGenerator<+Yield,+Return,-Next> {
^^^^^ [3]


Expand All @@ -237,14 +237,14 @@ string [1] is incompatible with number [2] in type argument `Yield` [3]. [incomp
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
<BUILTINS>/core.js:2250:58
2250| T extends $ReadOnlyArray<mixed> ? {[K in keyof T]: Awaited<T[K]>} :
<BUILTINS>/core.js:2255:58
2255| T extends $ReadOnlyArray<mixed> ? {[K in keyof T]: Awaited<T[K]>} :
^^^^^^^^^^^^^ [1]
generator.js:21:45
21| async function *genError1(): AsyncGenerator<number, void, void> {
^^^^^^ [2]
<BUILTINS>/core.js:1968:27
1968| interface AsyncGenerator<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1973:27
1973| interface AsyncGenerator<+Yield,+Return,-Next> {
^^^^^ [3]


Expand All @@ -258,8 +258,8 @@ Cannot yield `1` because number [1], a primitive, cannot be used as a subtype of
^ [1]

References:
<BUILTINS>/core.js:1979:7
1979| : $Iterable<Yield, Return, Next>;
<BUILTINS>/core.js:1984:7
1984| : $Iterable<Yield, Return, Next>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]


Expand Down
4 changes: 2 additions & 2 deletions tests/async_iteration/async_iteration.exp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ Cannot cast `result.value` to string because undefined [1] is incompatible with
^^^^^^^^^^^^

References:
<BUILTINS>/core.js:1808:14
1808| +value?: Return,
<BUILTINS>/core.js:1813:14
1813| +value?: Return,
^^^^^^ [1]
return.js:20:20
20| (result.value: string); // error: number | void ~> string
Expand Down
4 changes: 2 additions & 2 deletions tests/babel_loose_array_spread/babel_loose_array_spread.exp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ property `@@iterator` of type argument `A`. [incompatible-type]
^^

References:
<BUILTINS>/core.js:1938:19
1938| @@iterator(): $IteratorProtocol<Yield,Return,Next>;
<BUILTINS>/core.js:1943:19
1943| @@iterator(): $IteratorProtocol<Yield,Return,Next>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/core.js:1180:17
1180| @@iterator(): Iterator<T>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ it into an object and attempt to use it as a subtype of an interface. [incompati
^ [1]

References:
<BUILTINS>/core.js:1937:11
1937| interface $Iterable<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1942:11
1942| interface $Iterable<+Yield,+Return,-Next> {
^^^^^^^^^ [2]


Expand All @@ -23,8 +23,8 @@ it into an object and attempt to use it as a subtype of an interface. [incompati
^ [1]

References:
<BUILTINS>/core.js:1937:11
1937| interface $Iterable<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1942:11
1942| interface $Iterable<+Yield,+Return,-Next> {
^^^^^^^^^ [2]


Expand Down
24 changes: 12 additions & 12 deletions tests/bigint/bigint.exp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ Cannot call `BigInt` with `null` bound to `value` because: [incompatible-type]
^^^^ [1]

References:
<BUILTINS>/core.js:2996:18
2996| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:3001:18
3001| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^^ [2]
<BUILTINS>/core.js:2996:28
2996| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:3001:28
3001| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^ [3]
<BUILTINS>/core.js:2996:37
2996| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:3001:37
3001| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^ [4]
<BUILTINS>/core.js:2996:46
2996| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:3001:46
3001| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^ [5]
<BUILTINS>/core.js:2996:55
2996| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:3001:55
3001| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^^^^^^^ [6]
<BUILTINS>/core.js:2996:70
2996| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:3001:70
3001| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^^^^^^^^^^^^^^^^ [7]


Expand Down
8 changes: 4 additions & 4 deletions tests/component_type/component_type.exp
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ References:
everything_implicit_instantiation.js:6:46
6| declare component B(ref: React.RefSetter<Set<string>>, foo: string, bar: number) renders? A;
^^^^^^ [2]
<BUILTINS>/core.js:2141:19
2141| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:2146:19
2146| declare class Set<T> extends $ReadOnlySet<T> {
^ [3]
<BUILTINS>/react.js:123:19
123| type RefSetter<-T> = React$RefSetter<T>;
Expand Down Expand Up @@ -821,8 +821,8 @@ References:
props_implicit_instantiation.js:7:46
7| declare component A(ref: React.RefSetter<Set<string>>, foo: string, bar: number);
^^^^^^ [2]
<BUILTINS>/core.js:2141:19
2141| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:2146:19
2146| declare class Set<T> extends $ReadOnlySet<T> {
^ [3]
<BUILTINS>/react.js:123:19
123| type RefSetter<-T> = React$RefSetter<T>;
Expand Down
20 changes: 10 additions & 10 deletions tests/contextual_typing/contextual_typing.exp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ expression to your expected type. [underconstrained-implicit-instantiation]
^^^

References:
<BUILTINS>/core.js:2141:19
2141| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:2146:19
2146| declare class Set<T> extends $ReadOnlySet<T> {
^ [1]
arr_rest.js:9:16
9| const [...y] = new Set() // still error
Expand Down Expand Up @@ -339,8 +339,8 @@ Property `@@iterator` is missing in function [1] but exists in `$Iterable` [2].
^^^^^^^^^^^ [1]

References:
<BUILTINS>/core.js:1937:11
1937| interface $Iterable<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1942:11
1942| interface $Iterable<+Yield,+Return,-Next> {
^^^^^^^^^ [2]


Expand Down Expand Up @@ -493,8 +493,8 @@ References:
implicit_instantiation.js:147:11
147| (a: Set<empty>); // error Set<string> ~> Set<empty>
^^^^^ [2]
<BUILTINS>/core.js:2141:19
2141| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:2146:19
2146| declare class Set<T> extends $ReadOnlySet<T> {
^ [3]


Expand All @@ -513,8 +513,8 @@ References:
implicit_instantiation.js:148:11
148| (b: Set<empty>); // error Set<string> ~> Set<empty>
^^^^^ [2]
<BUILTINS>/core.js:2141:19
2141| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:2146:19
2146| declare class Set<T> extends $ReadOnlySet<T> {
^ [3]


Expand Down Expand Up @@ -769,8 +769,8 @@ References:
lits.js:52:27
52| s2.values() as Iterator<string>; // error number ~> string
^^^^^^ [2]
<BUILTINS>/core.js:1831:25
1831| declare class Iterator<+Yield,+Return=void,-Next=void> implements $IteratorProtocol<Yield,Return,Next>, $Iterable<Yield,Return,Next> {
<BUILTINS>/core.js:1836:25
1836| declare class Iterator<+Yield,+Return=void,-Next=void> implements $IteratorProtocol<Yield,Return,Next>, $Iterable<Yield,Return,Next> {
^^^^^ [3]


Expand Down
Loading
Loading