1- /* eslint-disable import/first */
21import React , {
32 ComponentType ,
43 DetailedHTMLProps ,
@@ -27,7 +26,7 @@ type StepsProps = {
2726 children : ReactElement < StepProps > | ReactElement < StepProps > [ ] ;
2827} ;
2928
30- type BeforeStepChange = ( ... data : any [ ] ) => any ;
29+ type BeforeStepChange = ( ) => any ;
3130
3231interface StepProps {
3332 title ?: string ;
@@ -40,11 +39,14 @@ interface StepProps {
4039type EventType = React . ChangeEvent < HTMLInputElement > &
4140 React . ChangeEvent < HTMLTextAreaElement > ;
4241
43- type AllSteps = { order : number ; title ? : string } [ ] ;
42+ type AllSteps = { order : number ; title : string } [ ] ;
4443type OrderCheckFn = ( ) => boolean ;
4544type MoveFn = ( ) => void ;
4645type JumpFn = ( step : number ) => void ;
47- type GetState = ( key : keyof State , defaultValue : State [ keyof State ] ) => any ;
46+ type GetState = (
47+ key : keyof State ,
48+ defaultValue : State [ keyof State ] ,
49+ ) => InputValue | CheckboxValue ;
4850type SetState = ( key : keyof State , value : State [ keyof State ] ) => void ;
4951type HandleChange = ( event : EventType ) => void ;
5052
@@ -109,7 +111,7 @@ const StepsContext = React.createContext<StepsContext>({
109111 state : { } ,
110112 handleChange : ( event ) => { } ,
111113 setState : ( key , value ) => { } ,
112- getState : ( key , defaultValue ) => { } ,
114+ getState : ( key , defaultValue ) => "" || false || defaultValue ,
113115 next : ( ) => { } ,
114116 prev : ( ) => { } ,
115117 jump : ( id ) => { } ,
@@ -242,7 +244,7 @@ export function Step<T extends StepProps>(props: T) {
242244 } , [ current , order , beforeStepChange ] ) ;
243245
244246 if ( order === current ) {
245- const newProps : Partial < StepProps > = Object . assign ( { } , props ) ;
247+ const newProps : Partial < T > = Object . assign ( { } , props ) ;
246248 delete newProps . component ;
247249
248250 const defaultTitle = "Step " + order ;
0 commit comments