TypeScript Version: typescript@rc 2.3.0
Code
export interface IconProps {
size?: number;
}
// I use this to create a type that has `size` non-nullable
// (because it always present due to `defaultProps`
type SafeProps = IconProps & typeof Icon.defaultProps;
export default class Icon extends React.Component<IconProps, any> {
static defaultProps = {
size: 10
};
render() {
// cast to SafeProps to safely extract `size`
const { size } = this.props as SafeProps
return <div style={{ size }} />
}
}
Expected behavior:
It compiles. This actually works in 2.2.2
Actual behavior:
Class 'Icon' used before its declaration on line type SafeProps = IconProps & typeof Icon.defaultProps;
Is this an intended breaking change?
TypeScript Version: typescript@rc 2.3.0
Code
Expected behavior:
It compiles. This actually works in 2.2.2
Actual behavior:
Class 'Icon' used before its declarationon linetype SafeProps = IconProps & typeof Icon.defaultProps;Is this an intended breaking change?