Skip to content

Commit

Permalink
Use @flow in libdefs
Browse files Browse the repository at this point in the history
Reviewed By: mroch

Differential Revision: D29552345

fbshipit-source-id: d123578c32d0d5357c3fd409c1d9bd08000f9fd3
  • Loading branch information
dunnbobcat authored and facebook-github-bot committed Jul 9, 2021
1 parent e87d290 commit 70e70a2
Show file tree
Hide file tree
Showing 74 changed files with 2,504 additions and 2,469 deletions.
12 changes: 12 additions & 0 deletions lib/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[ignore]

[include]

[libs]
./

[lints]

[options]

[strict]
2 changes: 2 additions & 0 deletions lib/bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/* BOM */
Expand Down
2 changes: 2 additions & 0 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* MERCHANTABLITY OR NON-INFRINGEMENT.
* See the Apache Version 2.0 License for specific language governing permissions
* and limitations under the License.
*
* @flow
*/
// @lint-ignore-every LICENSELINT

Expand Down
2 changes: 2 additions & 0 deletions lib/cssom.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

declare class StyleSheet {
Expand Down
2 changes: 2 additions & 0 deletions lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* MERCHANTABLITY OR NON-INFRINGEMENT.
* See the Apache Version 2.0 License for specific language governing permissions
* and limitations under the License.
*
* @flow
*/
// @lint-ignore-every LICENSELINT

Expand Down
2 changes: 2 additions & 0 deletions lib/indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

// Implemented by window & worker
Expand Down
2 changes: 2 additions & 0 deletions lib/intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

declare var Intl: {
Expand Down
2 changes: 2 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

interface ErrnoError extends Error {
Expand Down
1 change: 1 addition & 0 deletions lib/react-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @nolint
* @format
* @flow
*/

// The react-dom, react-dom/server and react-dom/test-utils modules were moved to flow-typed.
Expand Down
2 changes: 2 additions & 0 deletions lib/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/serviceworkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

type FrameType = 'auxiliary' | 'top-level' | 'nested' | 'none';
Expand Down
2 changes: 2 additions & 0 deletions lib/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

type TextEncodeOptions = { options?: boolean, ... };
Expand Down
2 changes: 2 additions & 0 deletions lib/webassembly.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

// https://github.com/WebAssembly/design/blob/master/JS.md
Expand Down
4 changes: 2 additions & 2 deletions newtests/array_literal_tuple_spread/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ export default (suite(({addFile, addFiles, addCode}) => [
3: const arr: Array<number> = [..."hello"];
^^^^^^^^^^^^ Cannot assign array literal to \`arr\` because string [1] is incompatible with number [2] in array element. [incompatible-type]
References:
1078: @@iterator(): Iterator<string>;
^^^^^^ [1]. See lib: [LIB] core.js:1078
1080: @@iterator(): Iterator<string>;
^^^^^^ [1]. See lib: [LIB] core.js:1080
3: const arr: Array<number> = [..."hello"];
^^^^^^ [2]
`,
Expand Down
4 changes: 2 additions & 2 deletions newtests/tuples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export default (suite(({addFile, addFiles, addCode}) => [
6: readOnlyRef.push(123);
^^^^ Cannot call \`readOnlyRef.push\` because property \`push\` is missing in \`$ReadOnlyArray\` [1]. [prop-missing]
References:
748: forEach<This>(callbackfn: (this : This, value: T, index: number, array: $ReadOnlyArray<T>) => mixed, thisArg: This): void;
^^^^^^^^^^^^^^^^^ [1]. See lib: [LIB] core.js:748
750: forEach<This>(callbackfn: (this : This, value: T, index: number, array: $ReadOnlyArray<T>) => mixed, thisArg: This): void;
^^^^^^^^^^^^^^^^^ [1]. See lib: [LIB] core.js:750
test.js:7
7: (readOnlyRef[0]: 1);
Expand Down
8 changes: 4 additions & 4 deletions tests/arraylib/arraylib.exp
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ Cannot assign `arr3.flat(...)` to `result3_2` because mixed [1] is incompatible
^^^^^^^^^^^^

References:
<BUILTINS>/core.js:813:32
813| flat(depth: number): Array<mixed>;
<BUILTINS>/core.js:815:32
815| flat(depth: number): Array<mixed>;
^^^^^ [1]
flat.js:22:24
22| const result3_2: Array<number> = arr3.flat(2); // Error - don't support this
Expand All @@ -334,8 +334,8 @@ Cannot assign `arr2.flat(...)` to `result2_6` because mixed [1] is incompatible
^^^^^^^^^^^^

References:
<BUILTINS>/core.js:813:32
813| flat(depth: number): Array<mixed>;
<BUILTINS>/core.js:815:32
815| flat(depth: number): Array<mixed>;
^^^^^ [1]
flat.js:27:24
27| const result2_6: Array<number> = arr2.flat(x); // Error - don't support this
Expand Down
4 changes: 2 additions & 2 deletions tests/arrows/arrows.exp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ return value. [incompatible-call]
^^^^^^^^^^^^^^^^^^^^^^^^ [1]

References:
<BUILTINS>/core.js:1005:38
1005| sort(compareFn?: (a: T, b: T) => number): Array<T>;
<BUILTINS>/core.js:1007:38
1007| sort(compareFn?: (a: T, b: T) => number): Array<T>;
^^^^^^ [2]


Expand Down
24 changes: 12 additions & 12 deletions tests/async/async.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ References:
async.js:11:30
11| async function f1(): Promise<bool> {
^^^^ [2]
<BUILTINS>/core.js:1807:24
1807| declare class Promise<+R> {
<BUILTINS>/core.js:1809:24
1809| declare class Promise<+R> {
^ [3]


Expand All @@ -31,8 +31,8 @@ References:
async.js:30:48
30| async function f4(p: Promise<number>): Promise<bool> {
^^^^ [2]
<BUILTINS>/core.js:1807:24
1807| declare class Promise<+R> {
<BUILTINS>/core.js:1809:24
1809| declare class Promise<+R> {
^ [3]


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

References:
<BUILTINS>/core.js:1807:24
1807| declare class Promise<+R> {
<BUILTINS>/core.js:1809:24
1809| declare class Promise<+R> {
^ [2]


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


Expand All @@ -152,8 +152,8 @@ References:
async_return_void.js:7:32
7| async function foo2(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:1807:24
1807| declare class Promise<+R> {
<BUILTINS>/core.js:1809:24
1809| declare class Promise<+R> {
^ [3]


Expand All @@ -173,8 +173,8 @@ References:
async_return_void.js:11:32
11| async function foo3(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:1807:24
1807| declare class Promise<+R> {
<BUILTINS>/core.js:1809:24
1809| declare class Promise<+R> {
^ [3]


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 @@ -109,8 +109,8 @@ Cannot cast `result.value` to string because undefined [1] is incompatible with
^^^^^^^^^^^^

References:
<BUILTINS>/core.js:1633:14
1633| +value?: Return,
<BUILTINS>/core.js:1635:14
1635| +value?: Return,
^^^^^^ [1]
return.js:20:20
20| (result.value: string); // error: number | void ~> string
Expand Down
8 changes: 4 additions & 4 deletions tests/automatic_require_default/automatic_require_default.exp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Cannot get `Default.T` because property `T` is missing in `Number` [1]. [prop-mi
^

References:
<BUILTINS>/core.js:372:15
372| declare class Number {
<BUILTINS>/core.js:374:15
374| declare class Number {
^^^^^^ [1]


Expand All @@ -21,8 +21,8 @@ Cannot get `React.NotAType` because property `NotAType` is missing in module `re
^^^^^^^^

References:
<BUILTINS>/react.js:467:27
467| declare module.exports: $Exports<'react'>;
<BUILTINS>/react.js:469:27
469| declare module.exports: $Exports<'react'>;
^^^^^^^^^^^^^^^^^ [1]


Expand Down
Loading

0 comments on commit 70e70a2

Please sign in to comment.