Skip to content

Commit

Permalink
#11 Segregate Return type as alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Kirmas committed Mar 3, 2021
1 parent 0e5ed4d commit f185047
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ export type ClassNamingCall<Source extends CssModule, Used extends CssModule> =
>(
arg0?: true | StrictSub<Actions0, Source, Used>,
arg1?: ActionsOf<Source> extends Actions0 ? StrictSub<Actions1, Source, Used> : never
) => ClassNaming<
{[K in Exclude<keyof Source,
RequiredKeys<Actions0> | RequiredKeys<Actions1>
>]: ClassHash},
{[K in keyof Used
| RequiredKeys<Actions0> | RequiredKeys<Actions1>
]: ClassHash}
>
) => ClassNamingReturn<Source, Used, Actions0 | Actions1>
;

type ClassNamingReturn<Source extends CssModule, Used extends CssModule, Actions extends ActionsOf<Source>>
= ClassNaming<
{[K in Exclude<keyof Source,
RequiredKeys<Actions>
>]: ClassHash},
{[K in keyof Used
| RequiredKeys<Actions>
]: ClassHash}
>

export type ActionsOf<Source extends CssModule> = {[K in keyof Source]?: Action}
type StrictSub<Actions extends {[K in keyof Source]?: Action}, Source extends CssModule, Used extends CssModule>
= Actions & {
Expand Down

0 comments on commit f185047

Please sign in to comment.