Skip to content

Commit

Permalink
oops, no return types
Browse files Browse the repository at this point in the history
  • Loading branch information
oofdere committed Aug 12, 2024
1 parent 4af17da commit 6f6a073
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const pack = <E>(...entry: EnumChecked<E>) => entry satisfies EnumChecked
export const match = <E, Fn extends Arms<E>>(
pattern: Enum<E>,
arms: Fn,
) =>
// biome-ignore lint/suspicious/noExplicitAny: required
// biome-ignore lint/style/noNonNullAssertion: will never be null when short-circuited
((arms[pattern[0]] as any) || arms._!)(pattern[1] as any);;
// typescript REALLY hates this and I can't blame it
): ReturnType<typeof arms[keyof typeof arms]> =>
// ^ typescript ABSOLUTELY FREAKS OUT about this BUT it does work so ¯\_(ツ)_/¯
// biome-ignore lint/suspicious/noExplicitAny: return type is handled externally
((arms[pattern[0]] as any) || (arms as any)._)(pattern[1] as any);; // <- dunno why there are two semicolons here
// typescript REALLY hates this (hence all the `any`) and I really can't blame it

0 comments on commit 6f6a073

Please sign in to comment.