-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
The fix in #15687 did not get the original issue resolved, now that we have the apparent type, we can not spread T into a Component<T>.
here are a few samples:
import * as React from "react";
const decorator = function <T>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> {
return (props) => <Component {...props} ></Component> // should be ok
};
const decorator2 = function <T extends { x: number }>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> {
return (props) => <Component {...props} x={2} ></Component> // Should be ok, x is known
};
const decorator4 = function <T extends { x: number }>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> {
return (props) => <Component {...props} y={"blah"} ></Component> // Should be an error, unknown y
};Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue