Skip to content

Commit

Permalink
Merge pull request #130 from developit/fix-ts
Browse files Browse the repository at this point in the history
TS/React Component --> ComponentClass
  • Loading branch information
developit authored Jan 4, 2019
2 parents 1028258 + b3c8b04 commit 0c421af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare module "unistore/react" {
export function connect<T, S, K, I>(
mapStateToProps: string | Array<string> | StateMapper<T, K, I>,
actions?: ActionCreator<K> | object
): (Child: ((props: T & I) => React.ReactNode) | React.Component<T, S>) => React.Component<T, S>;
): (Child: ((props: T & I) => React.ReactNode) | React.ComponentClass<T, S>) => React.ComponentClass<T, S>;

export interface ProviderProps<T> {
store: Store<T>;
Expand All @@ -19,7 +19,7 @@ declare module "unistore/react" {
export class Provider<T> extends React.Component<ProviderProps<T>, {}> {
render(): React.ReactNode;
}

interface ComponentConstructor<P = {}, S = {}> {
new(props: P, context?: any): React.Component<P, S>;
}
Expand Down
6 changes: 2 additions & 4 deletions src/integrations/preact.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export function connect(mapStateToProps, actions) {
let mapped = mapStateToProps(store ? store.getState() : {}, this.props);
for (let i in mapped) if (mapped[i]!==state[i]) {
state = mapped;
this.setState();
return;
return this.setState();
}
for (let i in state) if (!(i in mapped)) {
state = mapped;
this.setState();
return;
return this.setState();
}
};
this.componentWillReceiveProps = update;
Expand Down

0 comments on commit 0c421af

Please sign in to comment.