mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix confused comment (#49094)
This commit is contained in:
parent
0df9462a96
commit
755d5ccad6
@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(14,27): error TS2698: Spread types may only be created from object types.
|
||||
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>'.
|
||||
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(13,27): error TS2698: Spread types may only be created from object types.
|
||||
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>'.
|
||||
Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'Readonly<WrapperComponentProps>'.
|
||||
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(16,27): error TS2698: Spread types may only be created from object types.
|
||||
tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(14,27): error TS2698: Spread types may only be created from object types.
|
||||
|
||||
|
||||
==== tests/cases/compiler/jsxExcessPropsAndAssignability.tsx (3 errors) ====
|
||||
@ -17,11 +17,9 @@ tests/cases/compiler/jsxExcessPropsAndAssignability.tsx(16,27): error TS2698: Sp
|
||||
|
||||
const props: ComposedComponentProps = null as any;
|
||||
|
||||
// Expected no error, got none - good
|
||||
<WrapperComponent {...props} myProp={'1000000'} />;
|
||||
~~~~~
|
||||
!!! error TS2698: Spread types may only be created from object types.
|
||||
// Expected error, but got none - bad!
|
||||
<WrapperComponent {...props} myProp={1000000} />;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'ComposedComponentProps & { myProp: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<WrapperComponentProps, any, any>> & Readonly<{ children?: ReactNode; }> & Readonly<WrapperComponentProps>'.
|
||||
|
||||
@ -11,9 +11,7 @@ const myHoc = <ComposedComponentProps extends 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} />;
|
||||
};
|
||||
|
||||
@ -37,8 +35,6 @@ var React = require("react");
|
||||
var myHoc = function (ComposedComponent) {
|
||||
var WrapperComponent = null;
|
||||
var props = null;
|
||||
// Expected no error, got none - good
|
||||
React.createElement(WrapperComponent, __assign({}, props, { myProp: '1000000' }));
|
||||
// Expected error, but got none - bad!
|
||||
React.createElement(WrapperComponent, __assign({}, props, { myProp: 1000000 }));
|
||||
};
|
||||
|
||||
@ -30,17 +30,15 @@ const myHoc = <ComposedComponentProps extends any>(
|
||||
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
|
||||
>ComposedComponentProps : Symbol(ComposedComponentProps, Decl(jsxExcessPropsAndAssignability.tsx, 4, 15))
|
||||
|
||||
// Expected no error, got none - good
|
||||
<WrapperComponent {...props} myProp={'1000000'} />;
|
||||
>WrapperComponent : Symbol(WrapperComponent, Decl(jsxExcessPropsAndAssignability.tsx, 8, 9))
|
||||
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
|
||||
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 12, 32))
|
||||
|
||||
<WrapperComponent {...props} myProp={1000000} />;
|
||||
>WrapperComponent : Symbol(WrapperComponent, Decl(jsxExcessPropsAndAssignability.tsx, 8, 9))
|
||||
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
|
||||
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 13, 32))
|
||||
|
||||
// Expected error, but got none - bad!
|
||||
<WrapperComponent {...props} myProp={1000000} />;
|
||||
>WrapperComponent : Symbol(WrapperComponent, Decl(jsxExcessPropsAndAssignability.tsx, 8, 9))
|
||||
>props : Symbol(props, Decl(jsxExcessPropsAndAssignability.tsx, 10, 9))
|
||||
>myProp : Symbol(myProp, Decl(jsxExcessPropsAndAssignability.tsx, 15, 32))
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import * as React from 'react';
|
||||
|
||||
const myHoc = <ComposedComponentProps extends any>(
|
||||
>myHoc : <ComposedComponentProps extends unknown>(ComposedComponent: React.ComponentClass<ComposedComponentProps, any>) => void
|
||||
><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
|
||||
><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
|
||||
|
||||
ComposedComponent: React.ComponentClass<ComposedComponentProps>,
|
||||
>ComposedComponent : React.ComponentClass<ComposedComponentProps, any>
|
||||
@ -28,7 +28,6 @@ const myHoc = <ComposedComponentProps extends any>(
|
||||
>null as any : any
|
||||
>null : null
|
||||
|
||||
// Expected no error, got none - good
|
||||
<WrapperComponent {...props} myProp={'1000000'} />;
|
||||
><WrapperComponent {...props} myProp={'1000000'} /> : JSX.Element
|
||||
>WrapperComponent : React.ComponentClass<ComposedComponentProps & { myProp: string; }, any>
|
||||
@ -36,7 +35,6 @@ const myHoc = <ComposedComponentProps extends any>(
|
||||
>myProp : "1000000"
|
||||
>'1000000' : "1000000"
|
||||
|
||||
// Expected error, but got none - bad!
|
||||
<WrapperComponent {...props} myProp={1000000} />;
|
||||
><WrapperComponent {...props} myProp={1000000} /> : JSX.Element
|
||||
>WrapperComponent : React.ComponentClass<ComposedComponentProps & { myProp: string; }, any>
|
||||
|
||||
@ -12,8 +12,6 @@ const myHoc = <ComposedComponentProps extends 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} />;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user