TypeScript/tests/cases/compiler/expandoFunctionContextualTypes.ts
Wesley Wigham f1370ecd54
Allow special assignments to have a contextual type of their declared type if present (#26802)
* Allow special assignments to have a contextual type of their declared type if present

* Expand change to cover all js special assignments

* Remove extraneous line
2018-09-04 15:58:18 -07:00

15 lines
280 B
TypeScript

interface MyComponentProps {
color: "red" | "blue"
}
interface StatelessComponent<P> {
(): any;
defaultProps?: Partial<P>;
}
const MyComponent: StatelessComponent<MyComponentProps> = () => null as any;
MyComponent.defaultProps = {
color: "red"
};