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

Commit

Permalink
Add typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunshine168 committed Feb 1, 2018
1 parent 1edd04a commit 1c54100
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function onError(cb: (error: Error) => void): () => void

export class Provider extends React.Component<any, {}> {}

export class Observer extends React.Component<{ children?: () => React.ReactNode }, {}> {}
export class Observer extends React.Component<{ children?: () => React.ReactNode, render?: () => React.ReactNode, inject?: IStoresToProps | string[] }, {}> {}

export function useStaticRendering(value: boolean): void

Expand Down
12 changes: 12 additions & 0 deletions test/ts/compile-ts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ class ObserverTest extends Component<any, any> {
}
}

class ObserverTest2 extends Component<any, any> {
render() {
return <Observer render={() => <div>test</div>} />;
}
}

class ObserverTest3 extends Component<any, any> {
render() {
return <Observer inject={["store"]} render={() => <div>test</div>} />;
}
}

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

0 comments on commit 1c54100

Please sign in to comment.