Skip to content

Commit 755d5cc

Browse files
authored
fix confused comment (#49094)
1 parent 0df9462 commit 755d5cc

5 files changed

+6
-18
lines changed

Diff for: tests/baselines/reference/jsxExcessPropsAndAssignability.errors.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(14,27): error TS2698: Spread types may only be created from object types.
2-
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(16,6): error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<WrapperComponentProps, any, any>> & Readonly<{ children?: ReactNode; }> & Readonly<WrapperComponentProps>'.
1+
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(13,27): error TS2698: Spread types may only be created from object types.
2+
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(14,6): error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<WrapperComponentProps, any, any>> & Readonly<{ children?: ReactNode; }> & Readonly<WrapperComponentProps>'.
33
Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'Readonly<WrapperComponentProps>'.
4-
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(16,27): error TS2698: Spread types may only be created from object types.
4+
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(14,27): error TS2698: Spread types may only be created from object types.
55

66

77
==== tests/cases/compiler/jsxExcessPropsAndAssignability.tsx (3 errors) ====
@@ -17,11 +17,9 @@ tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(16,27): error TS2698: Sp
1717

1818
const props: ComposedComponentProps = null as any;
1919

20-
// Expected no error, got none - good
2120
<WrapperComponent {...props} myProp={'1000000'} />;
2221
~~~~~
2322
!!! error TS2698: Spread types may only be created from object types.
24-
// Expected error, but got none - bad!
2523
<WrapperComponent {...props} myProp={1000000} />;
2624
~~~~~~~~~~~~~~~~
2725
!!! error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<WrapperComponentProps, any, any>> & Readonly<{ children?: ReactNode; }> & Readonly<WrapperComponentProps>'.

Diff for: tests/baselines/reference/jsxExcessPropsAndAssignability.js

-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ const myHoc = <ComposedComponentProps extends any>(
1111

1212
const props: ComposedComponentProps = null as any;
1313

14-
// Expected no error, got none - good
1514
<WrapperComponent {...props} myProp={'1000000'} />;
16-
// Expected error, but got none - bad!
1715
<WrapperComponent {...props} myProp={1000000} />;
1816
};
1917

@@ -37,8 +35,6 @@ var React = require("react");
3735
var myHoc = function (ComposedComponent) {
3836
var WrapperComponent = null;
3937
var props = null;
40-
// Expected no error, got none - good
4138
React.createElement(WrapperComponent, __assign({}, props, { myProp: '1000000' }));
42-
// Expected error, but got none - bad!
4339
React.createElement(WrapperComponent, __assign({}, props, { myProp: 1000000 }));
4440
};

Diff for: tests/baselines/reference/jsxExcessPropsAndAssignability.symbols

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,15 @@ const myHoc = <ComposedComponentProps extends any>(
3030
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
3131
>ComposedComponentProps : Symbol(ComposedComponentProps, Decl(jsxExcessPropsAndAssignability.tsx, 4, 15))
3232

33-
// Expected no error, got none - good
3433
<WrapperComponent {...props} myProp={'1000000'} />;
3534
>WrapperComponent : Symbol(WrapperComponent, Decl(jsxExcessPropsAndAssignability.tsx, 8, 9))
3635
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
37-
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 13, 32))
36+
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 12, 32))
3837

39-
// Expected error, but got none - bad!
4038
<WrapperComponent {...props} myProp={1000000} />;
4139
>WrapperComponent : Symbol(WrapperComponent, Decl(jsxExcessPropsAndAssignability.tsx, 8, 9))
4240
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
43-
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 15, 32))
41+
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 13, 32))
4442

4543
};
4644

Diff for: tests/baselines/reference/jsxExcessPropsAndAssignability.types

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as React from 'react';
66

77
const myHoc = <ComposedComponentProps extends any>(
88
>myHoc : <ComposedComponentProps extends unknown>(ComposedComponent: React.ComponentClass<ComposedComponentProps, any>) => void
9-
><ComposedComponentProps extends any>( ComposedComponent: React.ComponentClass<ComposedComponentProps>,) => { type WrapperComponentProps = ComposedComponentProps & { myProp: string }; const WrapperComponent: React.ComponentClass<WrapperComponentProps> = null as any; const props: ComposedComponentProps = null as any; // Expected no error, got none - good <WrapperComponent {...props} myProp={'1000000'} />; // Expected error, but got none - bad! <WrapperComponent {...props} myProp={1000000} />;} : <ComposedComponentProps extends unknown>(ComposedComponent: React.ComponentClass<ComposedComponentProps, any>) => void
9+
><ComposedComponentProps extends any>( ComposedComponent: React.ComponentClass<ComposedComponentProps>,) => { type WrapperComponentProps = ComposedComponentProps & { myProp: string }; const WrapperComponent: React.ComponentClass<WrapperComponentProps> = null as any; const props: ComposedComponentProps = null as any; <WrapperComponent {...props} myProp={'1000000'} />; <WrapperComponent {...props} myProp={1000000} />;} : <ComposedComponentProps extends unknown>(ComposedComponent: React.ComponentClass<ComposedComponentProps, any>) => void
1010

1111
ComposedComponent: React.ComponentClass<ComposedComponentProps>,
1212
>ComposedComponent : React.ComponentClass<ComposedComponentProps, any>
@@ -28,15 +28,13 @@ const myHoc = <ComposedComponentProps extends any>(
2828
>null as any : any
2929
>null : null
3030

31-
// Expected no error, got none - good
3231
<WrapperComponent {...props} myProp={'1000000'} />;
3332
><WrapperComponent {...props} myProp={'1000000'} /> : JSX.Element
3433
>WrapperComponent : React.ComponentClass<ComposedComponentProps & { myProp: string; }, any>
3534
>props : ComposedComponentProps
3635
>myProp : "1000000"
3736
>'1000000' : "1000000"
3837

39-
// Expected error, but got none - bad!
4038
<WrapperComponent {...props} myProp={1000000} />;
4139
><WrapperComponent {...props} myProp={1000000} /> : JSX.Element
4240
>WrapperComponent : React.ComponentClass<ComposedComponentProps & { myProp: string; }, any>

Diff for: tests/cases/compiler/jsxExcessPropsAndAssignability.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const myHoc = <ComposedComponentProps extends any>(
1212

1313
const props: ComposedComponentProps = null as any;
1414

15-
// Expected no error, got none - good
1615
<WrapperComponent {...props} myProp={'1000000'} />;
17-
// Expected error, but got none - bad!
1816
<WrapperComponent {...props} myProp={1000000} />;
1917
};

0 commit comments

Comments
 (0)