Skip to content

Instantly share code, notes, and snippets.

@renatoargh
Created September 21, 2023 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatoargh/d2a03ab44659d4a0e1857868e45181e4 to your computer and use it in GitHub Desktop.
Save renatoargh/d2a03ab44659d4a0e1857868e45181e4 to your computer and use it in GitHub Desktop.
type Leaf<T> = z.infer<ReturnType<typeof LeafSchema<z.ZodType<T>>>>
type NumberLeaf = Leaf<number>
const getLeafValue = <T>(leaf: Leaf<T>) => leaf.value;
const test = { 'value': 123 };
const val = getLeafValue(test);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment