Skip to content

Commit

Permalink
Fix otherwise type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
JAForbes committed Feb 18, 2024
1 parent bd647b5 commit ef64ec6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ export type Is<R extends string> = `is${R}`;
export type Get<R extends string> = `get${R}`;

type Otherwise<D extends Definition> = {
otherwise: <T, R extends Partial<keyof D>>(tags: R[]) => (fn: () => T) => {
otherwise: <R extends Partial<keyof D>>(tags: R[]) => <T>(fn: () => T) => {
[k in R]: () => T
}
}

type OtherwiseEmpty<D extends Definition> = {
otherwise: <T>() => (fn: () => T) => {
otherwise: () => <T>(fn: () => T) => {
[k in keyof D]: () => T
}
}
Expand All @@ -62,7 +62,7 @@ type InternalInstance<
K extends keyof D
> = ReturnType<Constructors<N, D>[K]>;

export type Instance<A extends API<any, any> > = InternalInstance<A["type"], A["definition"], keyof A["definition"]>
export type Instance<A extends API<any, any>> = InternalInstance<A["type"], A["definition"], keyof A["definition"]>

export type Superoute<N extends string, D extends Definition> = Constructors<
N,
Expand Down

0 comments on commit ef64ec6

Please sign in to comment.