Skip to content

Commit 9f2fcb8

Browse files
SamChou19815facebook-github-bot
authored andcommitted
[flow] Remove bom, cssom, dom, stream from bundled libdefs
Summary: Changelog: [lib] Since the last version, most of the bundled libdefs will no longer be maintained and shipped with Flow. Going forward, they should be downloaded from flow-typed. Starting from this version, we will also no longer ship a set of precise typing definition for jsx intrinsics. To maintain the same behavior as before, you should have a `flow-typed.config.json` in the root of your project with the following content: ``` { "env": ["node", "dom", "bom", "intl", "cssom", "indexeddb", "serviceworkers", "webassembly", "jsx"] } ``` Reviewed By: jbrown215 Differential Revision: D70409195 fbshipit-source-id: 483f214a71d11f3f98cf2e077fe4a88f49e2c5d6
1 parent 632778a commit 9f2fcb8

File tree

23 files changed

+162
-6151
lines changed

23 files changed

+162
-6151
lines changed

lib/bom.js

Lines changed: 0 additions & 575 deletions
This file was deleted.

lib/cssom.js

Lines changed: 0 additions & 555 deletions
This file was deleted.

lib/dom.js

Lines changed: 0 additions & 4471 deletions
This file was deleted.

lib/streams.js

Lines changed: 0 additions & 127 deletions
This file was deleted.

newtests/lsp/queries/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ module.exports = (suite(
310310
[
311311
[
312312
'telemetry/rage',
313-
'{Focused: 8,LSP adapter state: Connected,.monitor_log,.log}',
313+
'{Focused: 4,LSP adapter state: Connected,.monitor_log,.log}',
314314
],
315315
],
316316
[...lspIgnoreStatusAndCancellation],

tests/arrows/arrows.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ function selectBestEffortImageForWidth(
88
return images.find(image => image.width >= maxPixelWidth) ||
99
images[images.length - 1];
1010
}
11+
12+
declare class Image {
13+
width: number
14+
}

tests/autocomplete_from_m_to_q/autocomplete_from_m_to_q.exp

Lines changed: 1 addition & 243 deletions
Large diffs are not rendered by default.

tests/component_syntax/component_syntax.exp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,13 +3196,12 @@ References:
31963196
Error --------------------------------------------------------------------------------------------------- refs.js:105:23
31973197

31983198
Cannot create `GenericRef1` element because in property `ref`: [incompatible-type]
3199-
- Either `HTMLElement` [1] is not a subtype of object type [2]. Class instances are not subtypes of object types;
3200-
consider rewriting object type [2] as an interface.
3201-
- Or `HTMLElement` [1] is incompatible with function type [3]. Non-callable objects are not compatible with functions.
3199+
- Either number [1] is incompatible with object type [2].
3200+
- Or number [1] is incompatible with function type [3].
32023201

32033202
refs.js:105:23
3204-
105| <GenericRef1 ref={new HTMLElement()} />; // error
3205-
^^^^^^^^^^^^^^^^^ [1]
3203+
105| <GenericRef1 ref={1} />; // error
3204+
^ [1]
32063205

32073206
References:
32083207
<BUILTINS>/react.js:113:5

tests/component_syntax/refs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ import * as React from 'react';
102102

103103
<GenericRef1 ref={(r: string | null) => {}} />; // ok
104104
<GenericRef1 ref={(r: number | null) => {}} />; // ok
105-
<GenericRef1 ref={new HTMLElement()} />; // error
105+
<GenericRef1 ref={1} />; // error
106106
<GenericRef2 ref={(r: Array<Array<Array<string>>> | null) => {}} />; // ok
107107
<GenericRef2 ref={(r: Array<Array<Array<number>>> | null) => {}} />; // ok
108108
<GenericRef2 ref={(r: string | null) => {}} />; // error

tests/declare_namespace/declare_namespace.exp

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -471,48 +471,54 @@ Cannot resolve name `React`. [cannot-resolve-name]
471471

472472
Error --------------------------------------------------------------------------------- type_only_react_namespace.js:5:3
473473

474-
Cannot cast `new HTMLAnchorElement()` to `Node` because: [incompatible-cast]
475-
- Either `HTMLAnchorElement` [1] is incompatible with `React.Element` [2].
476-
- Or `HTMLAnchorElement` [1] is incompatible with `React.Portal` [3].
477-
- Or property `@@iterator` is missing in `HTMLAnchorElement` [1] but exists in `$Iterable` [4].
474+
Cannot cast `Array` to `Node` because: [incompatible-cast]
475+
- Either class `Array` [1] is incompatible with `React.Element` [2].
476+
- Or class `Array` [1] is incompatible with `React.Portal` [3].
477+
- Or property `@@iterator` is missing in class `Array` [1] but exists in `$Iterable` [4].
478478

479479
type_only_react_namespace.js:5:3
480-
5| new HTMLAnchorElement() as React.Node; // error
481-
^^^^^^^^^^^^^^^^^^^^^^^ [1]
480+
5| Array as React.Node; // error
481+
^^^^^
482482

483483
References:
484+
<BUILTINS>/core.js:946:15
485+
946| declare class Array<T> extends $ReadOnlyArray<T> {
486+
^^^^^ [1]
484487
<BUILTINS>/react.js:21:5
485-
21| | React$Element<any>
486-
^^^^^^^^^^^^^^^^^^ [2]
488+
21| | React$Element<any>
489+
^^^^^^^^^^^^^^^^^^ [2]
487490
<BUILTINS>/react.js:22:5
488-
22| | React$Portal
489-
^^^^^^^^^^^^ [3]
491+
22| | React$Portal
492+
^^^^^^^^^^^^ [3]
490493
<BUILTINS>/react.js:23:5
491-
23| | Iterable<?React$Node>;
492-
^^^^^^^^^^^^^^^^^^^^^ [4]
494+
23| | Iterable<?React$Node>;
495+
^^^^^^^^^^^^^^^^^^^^^ [4]
493496

494497

495498
Error -------------------------------------------------------------------------------- type_only_react_namespace.js:12:3
496499

497-
Cannot cast `new HTMLAnchorElement()` to `Node` because: [incompatible-cast]
498-
- Either `HTMLAnchorElement` [1] is incompatible with `React.Element` [2].
499-
- Or `HTMLAnchorElement` [1] is incompatible with `React.Portal` [3].
500-
- Or property `@@iterator` is missing in `HTMLAnchorElement` [1] but exists in `$Iterable` [4].
500+
Cannot cast `Array` to `Node` because: [incompatible-cast]
501+
- Either class `Array` [1] is incompatible with `React.Element` [2].
502+
- Or class `Array` [1] is incompatible with `React.Portal` [3].
503+
- Or property `@@iterator` is missing in class `Array` [1] but exists in `$Iterable` [4].
501504

502505
type_only_react_namespace.js:12:3
503-
12| new HTMLAnchorElement() as React.Node; // error
504-
^^^^^^^^^^^^^^^^^^^^^^^ [1]
506+
12| Array as React.Node; // error
507+
^^^^^
505508

506509
References:
510+
<BUILTINS>/core.js:946:15
511+
946| declare class Array<T> extends $ReadOnlyArray<T> {
512+
^^^^^ [1]
507513
<BUILTINS>/react.js:21:5
508-
21| | React$Element<any>
509-
^^^^^^^^^^^^^^^^^^ [2]
514+
21| | React$Element<any>
515+
^^^^^^^^^^^^^^^^^^ [2]
510516
<BUILTINS>/react.js:22:5
511-
22| | React$Portal
512-
^^^^^^^^^^^^ [3]
517+
22| | React$Portal
518+
^^^^^^^^^^^^ [3]
513519
<BUILTINS>/react.js:23:5
514-
23| | Iterable<?React$Node>;
515-
^^^^^^^^^^^^^^^^^^^^^ [4]
520+
23| | Iterable<?React$Node>;
521+
^^^^^^^^^^^^^^^^^^^^^ [4]
516522

517523

518524
Error ----------------------------------------------------------------------------------------------- typing_test.js:7:1

tests/declare_namespace/type_only_react_namespace.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<div />; // ok
33
React; // error
44
1 as React.Node;
5-
new HTMLAnchorElement() as React.Node; // error
5+
Array as React.Node; // error
66
}
77
{
88
const React = require('react');
99
<div /> as React.Node; // ok
1010
React; // error
1111
1 as React.Node;
12-
new HTMLAnchorElement() as React.Node; // error
12+
Array as React.Node; // error
1313
}

tests/global_this/global_this.exp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,28 @@ References:
6969

7070
Error ----------------------------------------------------------------------------------------------------- test.js:10:1
7171

72-
Cannot cast `HTMLElement` to `Node` because: [incompatible-cast]
73-
- Either class `HTMLElement` [1] is incompatible with `React.Element` [2].
74-
- Or class `HTMLElement` [1] is incompatible with `React.Portal` [3].
75-
- Or property `@@iterator` is missing in class `HTMLElement` [1] but exists in `$Iterable` [4].
72+
Cannot cast `Array` to `Node` because: [incompatible-cast]
73+
- Either class `Array` [1] is incompatible with `React.Element` [2].
74+
- Or class `Array` [1] is incompatible with `React.Portal` [3].
75+
- Or property `@@iterator` is missing in class `Array` [1] but exists in `$Iterable` [4].
7676

7777
test.js:10:1
78-
10| HTMLElement as globalThis.React.Node; // error
79-
^^^^^^^^^^^
78+
10| Array as globalThis.React.Node; // error
79+
^^^^^
8080

8181
References:
82-
<BUILTINS>/dom.js:2092:15
83-
2092| declare class HTMLElement extends Element {
84-
^^^^^^^^^^^ [1]
82+
<BUILTINS>/core.js:946:15
83+
946| declare class Array<T> extends $ReadOnlyArray<T> {
84+
^^^^^ [1]
8585
<BUILTINS>/react.js:21:5
86-
21| | React$Element<any>
87-
^^^^^^^^^^^^^^^^^^ [2]
86+
21| | React$Element<any>
87+
^^^^^^^^^^^^^^^^^^ [2]
8888
<BUILTINS>/react.js:22:5
89-
22| | React$Portal
90-
^^^^^^^^^^^^ [3]
89+
22| | React$Portal
90+
^^^^^^^^^^^^ [3]
9191
<BUILTINS>/react.js:23:5
92-
23| | Iterable<?React$Node>;
93-
^^^^^^^^^^^^^^^^^^^^^ [4]
92+
23| | Iterable<?React$Node>;
93+
^^^^^^^^^^^^^^^^^^^^^ [4]
9494

9595

9696

tests/global_this/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ window.myGlobal as globalThis.Opaque; // ok: this is weird, but TS also supports
77
window.myGlobal as empty; // error
88
globalThis.myGlobal as empty; // error
99

10-
HTMLElement as globalThis.React.Node; // error
10+
Array as globalThis.React.Node; // error

tests/new_merge_diff/new_merge_diff.exp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ Error --------------------------------------------------------------------------
7878
Invalid trivially recursive definition of exports. [recursive-definition]
7979

8080

81+
Error ---------------------------------------------------------------------------------- recursive_module_cycle_B.js:0:1
82+
83+
Invalid trivially recursive definition of exports. [recursive-definition]
84+
85+
8186
Error ------------------------------------------------------------------------------------------ recursive_types.js:1:14
8287

8388
Invalid type annotation for `x`. It contains a reference [1] to the binding being declared. [recursive-definition]
@@ -169,7 +174,7 @@ Invalid trivially recursive definition of object type. [recursive-definition]
169174

170175

171176

172-
Found 15 errors
177+
Found 16 errors
173178

174179
Only showing the most relevant union/intersection branches.
175180
To see all branches, re-run Flow with --show-all-branches

tests/quick_start/quick_start.exp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Quick start.
66
Expect no errors.
77
No errors!
88

9-
The Flow server is currently in lazy mode and is only checking 7/8 files.
9+
The Flow server is currently in lazy mode and is only checking 3/4 files.
1010
To learn more, visit flow.org/en/docs/lang/lazy-modes
1111

1212
Change @flow file, expect error.
@@ -27,13 +27,13 @@ References:
2727

2828
Found 1 error
2929

30-
The Flow server is currently in lazy mode and is only checking 8/8 files.
30+
The Flow server is currently in lazy mode and is only checking 4/4 files.
3131
To learn more, visit flow.org/en/docs/lang/lazy-modes
3232

3333
Make file @noflow, expect error to go away.
3434
No errors!
3535

36-
The Flow server is currently in lazy mode and is only checking 7/7 files.
36+
The Flow server is currently in lazy mode and is only checking 3/3 files.
3737
To learn more, visit flow.org/en/docs/lang/lazy-modes
3838

3939
Revert file, expect error again.
@@ -54,7 +54,7 @@ References:
5454

5555
Found 1 error
5656

57-
The Flow server is currently in lazy mode and is only checking 8/8 files.
57+
The Flow server is currently in lazy mode and is only checking 4/4 files.
5858
To learn more, visit flow.org/en/docs/lang/lazy-modes
5959

6060
Done!

tests/quick_start_add_dependency/quick_start_add_dependency.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Quick start.
66
Expect no errors.
77
No errors!
88

9-
The Flow server is currently in lazy mode and is only checking 7/9 files.
9+
The Flow server is currently in lazy mode and is only checking 3/5 files.
1010
To learn more, visit flow.org/en/docs/lang/lazy-modes
1111

1212
Change @flow file with dependency on a @flow file, expect no error.
1313
No errors!
1414

15-
The Flow server is currently in lazy mode and is only checking 9/9 files.
15+
The Flow server is currently in lazy mode and is only checking 5/5 files.
1616
To learn more, visit flow.org/en/docs/lang/lazy-modes
1717

1818
Done!

0 commit comments

Comments
 (0)