From efe35182d024b61d1c5a897eba77e9df23844f45 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Fri, 22 Nov 2024 13:18:23 -0800 Subject: [PATCH] [flow][tests] Remove tests on `React.Config` Summary: Prepare for the eventual removal in v0.256 Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D66380514 fbshipit-source-id: 98d75db646d6d94fedef9177fe14aed85cd5dce5 --- tests/component_type/component_type.exp | 106 +++------- tests/component_type/config_HOC.js | 19 +- tests/get_def2/get_def2.exp | 8 - tests/get_def2/utilities.js | 8 - tests/new_generics/config.js | 20 -- tests/new_generics/new_generics.exp | 97 +-------- tests/new_generics/react.js | 16 -- .../new_merge_unsupported.exp | 186 +++++++++--------- .../ops_on_react_config.js | 4 +- .../type-destructor.js | 1 - 10 files changed, 126 insertions(+), 339 deletions(-) delete mode 100644 tests/new_generics/config.js diff --git a/tests/component_type/component_type.exp b/tests/component_type/component_type.exp index ca2b2ab4ece..631abb32eb1 100644 --- a/tests/component_type/component_type.exp +++ b/tests/component_type/component_type.exp @@ -327,114 +327,60 @@ References: ^ [3] -Error ----------------------------------------------------------------------------------------------- config_HOC.js:13:1 +Error ----------------------------------------------------------------------------------------------- config_HOC.js:10:1 -Cannot cast `y` to `NotTheRightConfig` because property `baz` is missing in `Props` [1] but exists in +Cannot cast `x` to `NotTheRightConfig` because property `baz` is missing in `Config` [1] but exists in `NotTheRightConfig` [2]. [prop-missing] - config_HOC.js:13:1 - 13| y as NotTheRightConfig; // Error, configs don't match + config_HOC.js:10:1 + 10| x as NotTheRightConfig; // Error, configs don't match ^ References: - config_HOC.js:8:16 - 8| declare var y: React.Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] - config_HOC.js:13:6 - 13| y as NotTheRightConfig; // Error, configs don't match + config_HOC.js:7:16 + 7| declare var x: Config; + ^^^^^^ [1] + config_HOC.js:10:6 + 10| x as NotTheRightConfig; // Error, configs don't match ^^^^^^^^^^^^^^^^^ [2] -Error ----------------------------------------------------------------------------------------------- config_HOC.js:13:1 +Error ----------------------------------------------------------------------------------------------- config_HOC.js:10:1 -Cannot cast `y` to `NotTheRightConfig` because property `qux` is missing in `Props` [1] but exists in +Cannot cast `x` to `NotTheRightConfig` because property `qux` is missing in `Config` [1] but exists in `NotTheRightConfig` [2]. [prop-missing] - config_HOC.js:13:1 - 13| y as NotTheRightConfig; // Error, configs don't match + config_HOC.js:10:1 + 10| x as NotTheRightConfig; // Error, configs don't match ^ References: - config_HOC.js:8:16 - 8| declare var y: React.Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] - config_HOC.js:13:6 - 13| y as NotTheRightConfig; // Error, configs don't match + config_HOC.js:7:16 + 7| declare var x: Config; + ^^^^^^ [1] + config_HOC.js:10:6 + 10| x as NotTheRightConfig; // Error, configs don't match ^^^^^^^^^^^^^^^^^ [2] -Error ----------------------------------------------------------------------------------------------- config_HOC.js:16:1 - -Cannot cast `z` to `React.Config` because property `bar` is missing in `NotTheRightConfig` [1] but exists in -`Props` [2]. [prop-missing] - - config_HOC.js:16:1 - 16| z as React.Config; // Error, configs don't match - ^ - -References: - config_HOC.js:15:16 - 15| declare var z: NotTheRightConfig; - ^^^^^^^^^^^^^^^^^ [1] - config_HOC.js:16:6 - 16| z as React.Config; // Error, configs don't match - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] - - -Error ----------------------------------------------------------------------------------------------- config_HOC.js:16:1 - -Cannot cast `z` to `React.Config` because property `foo` is missing in `NotTheRightConfig` [1] but exists in -`Props` [2]. [prop-missing] - - config_HOC.js:16:1 - 16| z as React.Config; // Error, configs don't match - ^ - -References: - config_HOC.js:15:16 - 15| declare var z: NotTheRightConfig; - ^^^^^^^^^^^^^^^^^ [1] - config_HOC.js:16:6 - 16| z as React.Config; // Error, configs don't match - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] - - -Error ---------------------------------------------------------------------------------------------- config_HOC.js:39:13 +Error ---------------------------------------------------------------------------------------------- config_HOC.js:27:13 Cannot create `WrappedComponent` element because property `bar` is missing in props [1] but exists in object type [2]. [prop-missing] - config_HOC.js:39:13 - 39| const _c = ; // Error missing bar + config_HOC.js:27:13 + 27| const _c = ; // Error missing bar ^^^^^^^^^^^^^^^^ References: - config_HOC.js:39:12 - 39| const _c = ; // Error missing bar + config_HOC.js:27:12 + 27| const _c = ; // Error missing bar ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] - config_HOC.js:30:41 - 30| class Component extends React.Component<{foo: number, bar: number, ...}> { + config_HOC.js:18:41 + 18| class Component extends React.Component<{foo: number, bar: number, ...}> { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] -Error ---------------------------------------------------------------------------------------------- config_HOC.js:44:13 - -Cannot create `WrappedComponent2` element because property `bar` is missing in props [1] but exists in object type [2]. -[prop-missing] - - config_HOC.js:44:13 - 44| const _f = ; // Error missing bar - ^^^^^^^^^^^^^^^^^ - -References: - config_HOC.js:44:12 - 44| const _f = ; // Error missing bar - ^^^^^^^^^^^^^^^^^^^^^ [1] - config_HOC.js:26:49 - 26| ): component(ref: React.RefSetter, ...React.Config) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] - - Error ------------------------------------------------------------------------------------------ create_element.js:15:13 Cannot create `C` element because property `bar` is missing in props [1] but exists in object type [2]. [prop-missing] @@ -1198,7 +1144,7 @@ expression. [signature-verification-failure] -Found 63 errors +Found 60 errors Only showing the most relevant union/intersection branches. To see all branches, re-run Flow with --show-all-branches diff --git a/tests/component_type/config_HOC.js b/tests/component_type/config_HOC.js index 5307b95f361..ac4e86a2959 100644 --- a/tests/component_type/config_HOC.js +++ b/tests/component_type/config_HOC.js @@ -5,15 +5,9 @@ type DefaultProps = {foo: number, ...}; type Config = {+foo?: number, +bar: number, ...}; declare var x: Config; -declare var y: React.Config; -x as React.Config; -y as Config; type NotTheRightConfig = {+baz: number, +qux: number, ...}; -y as NotTheRightConfig; // Error, configs don't match - -declare var z: NotTheRightConfig; -z as React.Config; // Error, configs don't match +x as NotTheRightConfig; // Error, configs don't match function HOC( x: component(ref: React.RefSetter, ...Config), @@ -21,12 +15,6 @@ function HOC( return x; } -function HOC2( - x: component(ref: React.RefSetter, ...React.Config), -): component(ref: React.RefSetter, ...React.Config) { - return x; -} - class Component extends React.Component<{foo: number, bar: number, ...}> { static defaultProps: {foo: number, ...} = {foo: 3}; } @@ -37,8 +25,3 @@ const WrappedComponent = HOC(Component); const _a = ; const _b = ; const _c = ; // Error missing bar - -const WrappedComponent2 = HOC2<{foo: number, bar: number, ...}, {foo: number, ...}, _>( - Component, -); -const _f = ; // Error missing bar diff --git a/tests/get_def2/get_def2.exp b/tests/get_def2/get_def2.exp index 2e93ad4234d..90cf18a4638 100644 --- a/tests/get_def2/get_def2.exp +++ b/tests/get_def2/get_def2.exp @@ -303,11 +303,3 @@ utilities.js:113:21 Flags: utilities.js:3:33,3:35 -utilities.js:119:12 -Flags: -utilities.js:3:20,3:22 - -utilities.js:121:21 -Flags: -utilities.js:3:33,3:35 - diff --git a/tests/get_def2/utilities.js b/tests/get_def2/utilities.js index 316f1f1d9e5..5c58e781078 100644 --- a/tests/get_def2/utilities.js +++ b/tests/get_def2/utilities.js @@ -113,11 +113,3 @@ f = () => { ; // ^ } - -f = () => { - declare const Comp: React.ComponentType>; - ; -// ^ - ; -// ^ -} diff --git a/tests/new_generics/config.js b/tests/new_generics/config.js deleted file mode 100644 index 634e83085ac..00000000000 --- a/tests/new_generics/config.js +++ /dev/null @@ -1,20 +0,0 @@ -//@flow - -import * as React from 'react'; -type Props = {foo: number, bar: number}; -type DefaultProps = {foo: number}; -type Config = {+foo?: number, +bar: number}; -type NotTheRightConfig = {+baz: number, +qux: number}; - -function f( - x: C, - y: React.Config, - z: W, -) { - x as React.Config; - y as Config; - y as C; // error, generics don't match - y as React.Config; - y as NotTheRightConfig; // Error, configs don't match - z as React.Config; // Error, configs don't match -} diff --git a/tests/new_generics/new_generics.exp b/tests/new_generics/new_generics.exp index 128df656769..c44f3586584 100644 --- a/tests/new_generics/new_generics.exp +++ b/tests/new_generics/new_generics.exp @@ -428,95 +428,6 @@ References: ^^^^^^^^^^^^^^ [1] -Error --------------------------------------------------------------------------------------------------- config.js:16:3 - -Cannot cast `y` to `C` because `Props` [1] is incompatible with `C` [2]. [incompatible-cast] - - config.js:16:3 - 16| y as C; // error, generics don't match - ^ - -References: - config.js:11:6 - 11| y: React.Config, - ^^^^^^^^^^^^^^^^^^ [1] - config.js:16:8 - 16| y as C; // error, generics don't match - ^ [2] - - -Error --------------------------------------------------------------------------------------------------- config.js:18:3 - -Cannot cast `y` to `NotTheRightConfig` because property `baz` is missing in `Props` [1] but exists in -`NotTheRightConfig` [2]. [prop-missing] - - config.js:18:3 - 18| y as NotTheRightConfig; // Error, configs don't match - ^ - -References: - config.js:11:6 - 11| y: React.Config, - ^^^^^^^^^^^^^^^^^^ [1] - config.js:18:8 - 18| y as NotTheRightConfig; // Error, configs don't match - ^^^^^^^^^^^^^^^^^ [2] - - -Error --------------------------------------------------------------------------------------------------- config.js:18:3 - -Cannot cast `y` to `NotTheRightConfig` because property `qux` is missing in `Props` [1] but exists in -`NotTheRightConfig` [2]. [prop-missing] - - config.js:18:3 - 18| y as NotTheRightConfig; // Error, configs don't match - ^ - -References: - config.js:11:6 - 11| y: React.Config, - ^^^^^^^^^^^^^^^^^^ [1] - config.js:18:8 - 18| y as NotTheRightConfig; // Error, configs don't match - ^^^^^^^^^^^^^^^^^ [2] - - -Error --------------------------------------------------------------------------------------------------- config.js:19:3 - -Cannot cast `z` to `React.Config` because property `bar` is missing in `NotTheRightConfig` [1] but exists in -`Props` [2]. [prop-missing] - - config.js:19:3 - 19| z as React.Config; // Error, configs don't match - ^ - -References: - config.js:12:6 - 12| z: W, - ^ [1] - config.js:19:8 - 19| z as React.Config; // Error, configs don't match - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] - - -Error --------------------------------------------------------------------------------------------------- config.js:19:3 - -Cannot cast `z` to `React.Config` because property `foo` is missing in `NotTheRightConfig` [1] but exists in -`Props` [2]. [prop-missing] - - config.js:19:3 - 19| z as React.Config; // Error, configs don't match - ^ - -References: - config.js:12:6 - 12| z: W, - ^ [1] - config.js:19:8 - 19| z as React.Config; // Error, configs don't match - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] - - Error --------------------------------------------------------------------------------- detect_literal_subtypes.js:15:13 Invalid check of string literal `b` against string literal `a` [1] because string literal `b` [2] is incompatible with @@ -1146,13 +1057,13 @@ References: ^^^^^ [3] -Error --------------------------------------------------------------------------------------------------- react.js:62:26 +Error --------------------------------------------------------------------------------------------------- react.js:46:26 Cannot get `X.defaultProps` because property `defaultProps` is missing in `React.AbstractComponentStatics` [1]. [prop-missing] - react.js:62:26 - 62| C.defaultProps = {...X.defaultProps}; // nope + react.js:46:26 + 46| C.defaultProps = {...X.defaultProps}; // nope ^^^^^^^^^^^^ References: @@ -1578,7 +1489,7 @@ References: -Found 92 errors +Found 87 errors Only showing the most relevant union/intersection branches. To see all branches, re-run Flow with --show-all-branches diff --git a/tests/new_generics/react.js b/tests/new_generics/react.js index 5a3545e4a22..a1432bdc974 100644 --- a/tests/new_generics/react.js +++ b/tests/new_generics/react.js @@ -18,16 +18,6 @@ type DefaultProps = {| b: string, |}; -function f( - InputComponent: React.ComponentType, -): React.ComponentType> { - return class extends React.Component> { - f() { - const inputComponent = ; - } - }; -} - function connect(): React.ComponentType { return class extends React.Component {}; } @@ -44,12 +34,6 @@ function HOC( return x; } -function HOC2( - x: component(ref: React.RefSetter, ...React.Config), -): component(ref: React.RefSetter, ...React.Config) { - return x; -} - function WrapInDivWithExtraProp( X: component(ref: React.RefSetter, ...Props), ): component(...{|...$Exact, baz: number|}) { diff --git a/tests/new_merge_unsupported/new_merge_unsupported.exp b/tests/new_merge_unsupported/new_merge_unsupported.exp index b35e1cb885b..9efb2f5e0d0 100644 --- a/tests/new_merge_unsupported/new_merge_unsupported.exp +++ b/tests/new_merge_unsupported/new_merge_unsupported.exp @@ -517,22 +517,22 @@ References: Error ------------------------------------------------------------------------------------- ops_on_react_config.js:10:25 -Cannot use class extends on config of React component [1] in an export position. Please provide an (alternative) -annotation for class extends [2]. [invalid-exported-annotation] +Cannot use class extends on conditional type [1] in an export position. Please provide an (alternative) annotation for +class extends [2]. [invalid-exported-annotation] ops_on_react_config.js:10:25 - 10| export class x1 extends ((0: any): T) {} - ^^^^^^^^^^^^^ [2] + 10| export class x1 extends ((0: any): T) {} + ^^^^^^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:10:36 -Cannot extend `x1` [1] with `T` because `Props` [2] is not inheritable. [incompatible-use] +Cannot extend `x1` [1] with `T` because object type [2] is not inheritable. [incompatible-use] ops_on_react_config.js:10:36 10| export class x1 extends ((0: any): T) {} @@ -546,32 +546,32 @@ References: Error ------------------------------------------------------------------------------------- ops_on_react_config.js:13:19 -Cannot use property `f` on config of React component [1] in an export position. Please provide an (alternative) -annotation for property `f` [2]. [invalid-exported-annotation] +Cannot use property `f` on conditional type [1] in an export position. Please provide an (alternative) annotation for +property `f` [2]. [invalid-exported-annotation] ops_on_react_config.js:13:19 - 13| export const x2 = t.f; - ^^^ [2] + 13| export const x2 = t.f; + ^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:16:19 -Cannot use computed property on config of React component [1] in an export position. Please provide an (alternative) -annotation for computed property [2]. [invalid-exported-annotation] +Cannot use computed property on conditional type [1] in an export position. Please provide an (alternative) annotation +for computed property [2]. [invalid-exported-annotation] ops_on_react_config.js:16:19 - 16| export const x3 = t[('': string)]; - ^^^^^^^^^^^^^^^ [2] + 16| export const x3 = t[('': string)]; + ^^^^^^^^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:16:26 @@ -584,52 +584,52 @@ Cannot access object with computed property using string [1]. [invalid-computed- Error ------------------------------------------------------------------------------------- ops_on_react_config.js:19:19 -Cannot use spread on config of React component [1] in an export position. Please provide an (alternative) annotation for +Cannot use spread on conditional type [1] in an export position. Please provide an (alternative) annotation for spread [2]. [invalid-exported-annotation] ops_on_react_config.js:19:19 - 19| export const x4 = { ...t }; - ^^^^^^^^ [2] + 19| export const x4 = { ...t }; + ^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:22:17 -Cannot use exact on config of React component [1] in an export position. Please provide an (alternative) annotation for +Cannot use exact on conditional type [1] in an export position. Please provide an (alternative) annotation for exact [2]. [invalid-exported-annotation] ops_on_react_config.js:22:17 - 22| declare var y5: $Exact; - ^^^^^^^^^ [2] + 22| declare var y5: $Exact; + ^^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:26:17 -Cannot use statics on config of React component [1] in an export position. Please provide an (alternative) annotation -for statics [2]. [invalid-exported-annotation] +Cannot use statics on conditional type [1] in an export position. Please provide an (alternative) annotation for +statics [2]. [invalid-exported-annotation] ops_on_react_config.js:26:17 - 26| declare var y6: Class; - ^^^^^^^^ [2] + 26| declare var y6: Class; + ^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:27:19 -`Props` [1] is not an instance type. [incompatible-use] +object type [1] is not an instance type. [incompatible-use] ops_on_react_config.js:27:19 27| export const x6 = y6.f; @@ -643,7 +643,7 @@ References: Error ------------------------------------------------------------------------------------- ops_on_react_config.js:30:14 -Cannot extend statics of `T` [1] with `c7` because `Props` [1] is not inheritable. [incompatible-use] +Cannot extend statics of `T` [1] with `c7` because object type [1] is not inheritable. [incompatible-use] ops_on_react_config.js:30:14 30| export class c7 extends ((0: any): Class) {} @@ -657,52 +657,52 @@ References: Error ------------------------------------------------------------------------------------- ops_on_react_config.js:32:19 -Cannot use property `f` on config of React component [1] in an export position. Please provide an (alternative) -annotation for property `f` [2]. [invalid-exported-annotation] +Cannot use property `f` on conditional type [1] in an export position. Please provide an (alternative) annotation for +property `f` [2]. [invalid-exported-annotation] ops_on_react_config.js:32:19 - 32| export const x7 = y7.f; - ^^^^ [2] + 32| export const x7 = y7.f; + ^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:35:37 -Cannot use prototype on config of React component [1] in an export position. Please provide an (alternative) annotation -for prototype [2]. [invalid-exported-annotation] +Cannot use prototype on conditional type [1] in an export position. Please provide an (alternative) annotation for +prototype [2]. [invalid-exported-annotation] ops_on_react_config.js:35:37 - 35| declare export var x8: { __proto__: T }; - ^ [2] + 35| declare export var x8: { __proto__: T }; + ^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:38:32 -Cannot use mixins on config of React component [1] in an export position. Please provide an (alternative) annotation for +Cannot use mixins on conditional type [1] in an export position. Please provide an (alternative) annotation for mixins [2]. [invalid-exported-annotation] ops_on_react_config.js:38:32 - 38| declare export class x9 mixins t {} - ^ [2] + 38| declare export class x9 mixins t {} + ^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:38:32 -`Props` [1] is not a class. [not-a-class] +object type [1] is not a class. [not-a-class] ops_on_react_config.js:38:32 38| declare export class x9 mixins t {} @@ -716,22 +716,22 @@ References: Error ------------------------------------------------------------------------------------- ops_on_react_config.js:41:20 -Cannot use unary minus on config of React component [1] in an export position. Please provide an (alternative) -annotation for unary minus [2]. [invalid-exported-annotation] +Cannot use unary minus on conditional type [1] in an export position. Please provide an (alternative) annotation for +unary minus [2]. [invalid-exported-annotation] ops_on_react_config.js:41:20 - 41| export const x10 = -t; - ^^ [2] + 41| export const x10 = -t; + ^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:41:21 -Cannot perform arithmetic operation because `Props` [1] is not a number or bigint. [unsafe-arithmetic] +Cannot perform arithmetic operation because object type [1] is not a number or bigint. [unsafe-arithmetic] ops_on_react_config.js:41:21 41| export const x10 = -t; @@ -745,47 +745,47 @@ References: Error ------------------------------------------------------------------------------------- ops_on_react_config.js:44:20 -Cannot use unary not on config of React component [1] in an export position. Please provide an (alternative) annotation -for unary not [2]. [invalid-exported-annotation] +Cannot use unary not on conditional type [1] in an export position. Please provide an (alternative) annotation for unary +not [2]. [invalid-exported-annotation] ops_on_react_config.js:44:20 - 44| export const x11 = !t; - ^^ [2] + 44| export const x11 = !t; + ^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:47:18 -Cannot use `$KeyMirror` on config of React component [1] in an export position. Please provide an (alternative) -annotation for `$KeyMirror` [2]. [invalid-exported-annotation] +Cannot use `$KeyMirror` on conditional type [1] in an export position. Please provide an (alternative) annotation for +`$KeyMirror` [2]. [invalid-exported-annotation] ops_on_react_config.js:47:18 - 47| declare var y12: $KeyMirror; - ^^^^^^^^^^^^^ [2] + 47| declare var y12: $KeyMirror; + ^^^^^^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------- ops_on_react_config.js:51:18 -Cannot use key set on config of React component [1] in an export position. Please provide an (alternative) annotation -for key set [2]. [invalid-exported-annotation] +Cannot use key set on conditional type [1] in an export position. Please provide an (alternative) annotation for key +set [2]. [invalid-exported-annotation] ops_on_react_config.js:51:18 - 51| declare var y13: $Keys; - ^^^^^^^^ [2] + 51| declare var y13: $Keys; + ^^^^^^^^ [2] References: - /react.js:399:53 - 399| declare export type Config = React$Config; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] + ops_on_react_config.js:6:10 + 6| type T = {f?: number, g: number} extends (infer O) ? O : empty; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] diff --git a/tests/new_merge_unsupported/ops_on_react_config.js b/tests/new_merge_unsupported/ops_on_react_config.js index 239777e159c..8aa699fb6ee 100644 --- a/tests/new_merge_unsupported/ops_on_react_config.js +++ b/tests/new_merge_unsupported/ops_on_react_config.js @@ -1,9 +1,9 @@ const React = require('react'); -type Props = {f: number, g: number}; +type Props = {f?: number, g: number}; type DefaultProps = {f: number}; -type T = React.Config; +type T = {f?: number, g: number} extends (infer O) ? O : empty; declare var t: T; // Annot_SpecializeT diff --git a/tests/type_at_pos_type_destructors/type-destructor.js b/tests/type_at_pos_type_destructors/type-destructor.js index 1609c70684d..1c361f4ba67 100644 --- a/tests/type_at_pos_type_destructors/type-destructor.js +++ b/tests/type_at_pos_type_destructors/type-destructor.js @@ -194,4 +194,3 @@ function non_evaluated() { // React.ElementPropsType // React.ElementConfigType // React.ElementRefType -// React.ConfigType