Skip to content

Commit 0c421af

Browse files
authored
Merge pull request #130 from developit/fix-ts
TS/React Component --> ComponentClass
2 parents 1028258 + b3c8b04 commit 0c421af

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

react.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ declare module "unistore/react" {
1010
export function connect<T, S, K, I>(
1111
mapStateToProps: string | Array<string> | StateMapper<T, K, I>,
1212
actions?: ActionCreator<K> | object
13-
): (Child: ((props: T & I) => React.ReactNode) | React.Component<T, S>) => React.Component<T, S>;
13+
): (Child: ((props: T & I) => React.ReactNode) | React.ComponentClass<T, S>) => React.ComponentClass<T, S>;
1414

1515
export interface ProviderProps<T> {
1616
store: Store<T>;
@@ -19,7 +19,7 @@ declare module "unistore/react" {
1919
export class Provider<T> extends React.Component<ProviderProps<T>, {}> {
2020
render(): React.ReactNode;
2121
}
22-
22+
2323
interface ComponentConstructor<P = {}, S = {}> {
2424
new(props: P, context?: any): React.Component<P, S>;
2525
}

src/integrations/preact.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ export function connect(mapStateToProps, actions) {
2727
let mapped = mapStateToProps(store ? store.getState() : {}, this.props);
2828
for (let i in mapped) if (mapped[i]!==state[i]) {
2929
state = mapped;
30-
this.setState();
31-
return;
30+
return this.setState();
3231
}
3332
for (let i in state) if (!(i in mapped)) {
3433
state = mapped;
35-
this.setState();
36-
return;
34+
return this.setState();
3735
}
3836
};
3937
this.componentWillReceiveProps = update;

0 commit comments

Comments
 (0)