Exclude, Extract & NonNullable
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Këto tipe ndihmëse punojnë me union-e: Exclude<T, U> heq disa opsione, Extract<T, U> mban vetëm disa, dhe NonNullable<T> heq null dhe undefined.
EnglishEN
These helper types work on unions: Exclude<T, U> removes some options, Extract<T, U> keeps only some, and NonNullable<T> removes null and undefined.
Si ta mendosh
Si ta pastrosh listën e mysafirëve: heq disa emra, ose mban vetëm familjen.
Lexoje në anglisht
Like editing a guest list: cross some names off, or keep only family.
Shembull koditypescript
type Ngjyra = "kuqe" | "blu" | "gjelber";
type PaKuqe = Exclude<Ngjyra, "kuqe">; // "blu" | "gjelber"
type Emri = NonNullable<string | null | undefined>; // string