Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Allow Component<void, void>
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrotoff committed Jan 11, 2017
1 parent 44ea13d commit 63be8ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.d.ts
Expand Up @@ -8,7 +8,7 @@ export type IReactComponent<P> = React.StatelessComponent<P> | React.ComponentCl

export function observer<P>(clazz: IReactComponent<P>): React.ClassicComponentClass<P>;
export function observer<P>(clazz: React.ClassicComponentClass<P>): React.ClassicComponentClass<P>;
export function observer<P, TFunction extends React.ComponentClass<P>>(target: TFunction): TFunction; // decorator signature
export function observer<P, TFunction extends React.ComponentClass<P | void>>(target: TFunction): TFunction; // decorator signature

export function inject<P>(...stores: string[]): <TFunction extends IReactComponent<P>>(target: TFunction) => TFunction; // decorator signature
export function inject<T, P>(storesToProps : IStoresToProps<T, P>): <TFunction extends IReactComponent<T | P>>(target: TFunction) => TFunction; // decorator
Expand Down
10 changes: 10 additions & 0 deletions test/ts/compile-ts.tsx
Expand Up @@ -151,3 +151,13 @@ class ObserverTest extends Component<any, any> {
return <Observer>{() => <div>test</div>}</Observer>;
}
}

@observer
class ComponentWithoutPropsAndState extends Component<void, void> {
componentDidUpdate() {
}

render() {
return (<div>Hello!</div>)
}
}

0 comments on commit 63be8ad

Please sign in to comment.