Skip to content

Commit e063e2b

Browse files
committed
Fix #466: Type of setState argument should be Pick<StateType, K>
1 parent 472cb2b commit e063e2b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/preact.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ declare namespace preact {
4545

4646
linkState:(name:string) => (event: Event) => void;
4747

48-
setState(state:StateType, callback?:() => void):void;
49-
setState(fn:(prevState:StateType, props:PropsType) => StateType, callback?:() => void):void;
48+
setState<K extends keyof StateType>(state:Pick<StateType, K>, callback?:() => void):void;
49+
setState<K extends keyof StateType>(fn:(prevState:StateType, props:PropsType) => Pick<StateType, K>, callback?:() => void):void;
5050

5151
forceUpdate(): void;
5252

0 commit comments

Comments
 (0)