diff --git a/src/index.ts b/src/index.ts index 0096964..a8ce1bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,27 +25,29 @@ type InferState = Configs extends [ } & InferState : unknown; -type IsDuplicated = Names extends [ - infer One, +type InferStateNames = Configs extends [ + SliceConfig, ...infer Rest, ] - ? One extends Name - ? true - : IsDuplicated - : false; + ? { [name in Name]: Value } & InferStateNames + : unknown; + +type IsDuplicated = + Config extends SliceConfig + ? Extract, Name> extends never + ? Extract, keyof Actions> extends never + ? false + : true + : true + : false; type HasDuplicatedNames< Configs, - Names extends string[] = [], -> = Configs extends [ - SliceConfig, - ...infer Rest, -] - ? Name extends Names[number] + PrevConfigs extends Array = [], +> = Configs extends [infer One, ...infer Rest] + ? IsDuplicated extends true ? true - : IsDuplicated extends true - ? true - : HasDuplicatedNames + : HasDuplicatedNames : false; type HasDuplicatedArgs = Configs extends [