You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support 'static' to be used with 'abstract' and generic type #10603
This is more general than the generic type use case:
abstractclassBase{abstractfoo: stringstaticbar: string}classBaseExtendedextendsBase{foo='1'// expected error because static property is missing, but got none// static bar = '1'}
For context, I want this feature so I can properly type the static properties on my React class components. The React typings on DefinitelyTyped define a Component class, and a ComponentClass interface which includes the constructor and the static properties such as propTypes, displayName, and defaultProps. To type check a class component including its static properties, one has to define a class that extends Componentand annotate it as ComponentClass:
// error as expected, displayName should be stringconstReactComponent: ComponentClass<any>=classextendsComponent<any,any>{staticdisplayName=1render(){return<div>{this.props.name}</div>}};
If we had the feature requested here, we could consolidate the ComponentClass interface and the Component class into an abstract class with static properties.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
[-]Support 'static' to be used with 'abstract'[/-][+]Support 'static' to be used with 'abstract' and generic type[/+]OliverJAsh commentedon Jun 5, 2017
This is more general than the generic type use case:
For context, I want this feature so I can properly type the static properties on my React class components. The React typings on DefinitelyTyped define a
Componentclass, and aComponentClassinterface which includes the constructor and the static properties such aspropTypes,displayName, anddefaultProps. To type check a class component including its static properties, one has to define a class that extendsComponentand annotate it asComponentClass:If we had the feature requested here, we could consolidate the
ComponentClassinterface and theComponentclass into an abstract class with static properties.mhegazy commentedon Aug 28, 2017
looks like a duplicate of #14600
mhegazy commentedon Sep 12, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.