Skip to content

Get type from Input type or Input Ref #339

Answered by hayes
MartinPELCAT asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest option is probably just to define a helper to extract the type like this:

import { InputRef } from '@pothos/core';

type ShapeFromInput<T> = T extends InputRef<infer U> ? U : never;

export type AddressInputType = ShapeFromInput<typeof AddressInput>;

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@MartinPELCAT
Comment options

@hayes
Comment options

Answer selected by hayes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #338 on March 02, 2022 20:04.