Skip to content

Commit 5ca883b

Browse files
committed
fix(types): fix types of ofStatePart
1 parent 8cc80c1 commit 5ca883b

File tree

1 file changed

+42
-33
lines changed

1 file changed

+42
-33
lines changed

src/index.ts

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -166,40 +166,49 @@ function createOnActionCallback(
166166
};
167167
}
168168

169-
export type Configs<S> = Array<AssistantConfig<Assistant<any>, S>>;
170-
171-
export function ofStatePart<K extends string, A extends Assistant<any>>(
172-
select: K,
173-
config: { new (): A }
174-
): AssistantConfig<A, { [P in K]: StateOfAssistant<A> }>;
175-
export function ofStatePart<NewS, A extends Assistant<any>>(
176-
select: (s: NewS) => StateOfAssistant<A>,
177-
config: { new (): A }
178-
): AssistantConfig<A, NewS>;
179-
export function ofStatePart<
180-
K extends string,
181-
A extends Assistant<any>,
182-
S = StateOfAssistant<A>
183-
>(
184-
select: K,
185-
config: ConstructorAssistantConfig<A, S> | CreateAssistantConfig<A, S>
186-
): AssistantConfig<A, { [P in K]: S }>;
187-
export function ofStatePart<
188-
NewS,
189-
A extends Assistant<any>,
190-
S = StateOfAssistant<A>
191-
>(
192-
select: (s: NewS) => S,
193-
config: ConstructorAssistantConfig<A, S> | CreateAssistantConfig<A, S>
194-
): AssistantConfig<A, NewS>;
195-
export function ofStatePart<K extends string, S>(
196-
select: K,
197-
configs: Configs<S>
198-
): Configs<{ [P in K]: S }>;
199-
export function ofStatePart<NewS, S>(
200-
select: (s: NewS) => S,
169+
// export type Configs<S> = Array<AssistantConfig<Assistant<any>, S>>;
170+
export type Configs<S> = Array<AssistantConfig<Assistant<S>, any>>;
171+
172+
// export function ofStatePart<K extends string, A extends Assistant<any>>(
173+
// select: K,
174+
// config: { new (): A }
175+
// ): AssistantConfig<A, { [P in K]: StateOfAssistant<A> }>;
176+
// export function ofStatePart<NewS, A extends Assistant<any>>(
177+
// select: (s: NewS) => StateOfAssistant<A>,
178+
// config: { new (): A }
179+
// ): AssistantConfig<A, NewS>;
180+
// export function ofStatePart<
181+
// K extends string,
182+
// A extends Assistant<any>,
183+
// S = StateOfAssistant<A>
184+
// >(
185+
// select: K,
186+
// config: ConstructorAssistantConfig<A, S> | CreateAssistantConfig<A, S>
187+
// ): AssistantConfig<A, { [P in K]: S }>;
188+
// export function ofStatePart<
189+
// NewS,
190+
// A extends Assistant<any>,
191+
// S = StateOfAssistant<A>
192+
// >(
193+
// select: (s: NewS) => S,
194+
// config: ConstructorAssistantConfig<A, S> | CreateAssistantConfig<A, S>
195+
// ): AssistantConfig<A, NewS>;
196+
// export function ofStatePart<K extends string, S>(
197+
// select: K,
198+
// configs: Configs<S>
199+
// ): Configs<{ [P in K]: S }>;
200+
// export function ofStatePart<NewS, S>(
201+
// select: (s: NewS) => S,
202+
// configs: Configs<S>
203+
// ): Configs<NewS>;
204+
export function ofStatePart<S>(
205+
select: ((s: any) => any) | string,
201206
configs: Configs<S>
202-
): Configs<NewS>;
207+
): Configs<any>;
208+
export function ofStatePart<S>(
209+
select: ((s: any) => any) | string,
210+
configs: AssistantConfig<Assistant<S>, any>
211+
): AssistantConfig<Assistant<any>, any>;
203212
/** Implementation */
204213
export function ofStatePart(
205214
select: string | ((s: any) => any),

0 commit comments

Comments
 (0)