Skip to content

Stateless components and defaultProps bug #27425

Closed
@goloveychuk

Description

@goloveychuk

TypeScript Version: 3.2.0-dev.20180927

Search Terms:

Code

interface Props {
  text: string;
}

function BackButton(props: Props) {
  return <div/>
}
BackButton.defaultProps = {
  text: 'Go Back',
};
let a = <BackButton /> // error: text is missing in type {}

It works ok with React.Component. Also I tried to make LibraryManagedAttributes<C,P>={c: string} . This changed checking for Component, but not for SFC.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions