I'm trying to extract the type of a generic but without having access to it. So I can't use Extract
.
import { Feather } from '@expo/vector-icons'
// The type is the following but isn't exported
const Feather: Icon<"crosshair" | "database" | "disc" | "zap" | "droplet" | "sun" | "wind" | "feather" | "link" | "search" | "image" | "menu" | "radio" | "key" | "code" | "map" | "video" | "circle" | ... 267 more ... | "zoom-out", "feather">
// ... how to get it icon list enum?
I'm trying to get a type with "crosshair" | "database" | "disc" | "zap" ...
I also tried this other answer
type TypeOfFeather = typeof Feather
type extractGeneric<T> = T extends TypeOfFeather <infer X> ? X : never
Which obviously doesn't work because the TypeOfFeather
is not a generic. I'm quite a beginner at Typescript so I don't really know how to figure this out.