Effect CommunityEC
Effect Community3y ago
4 replies
imagio

Defining Extra Type Aliases for Generics in TypeScript

Perhaps a dumb question, but is there a syntax for defining extra type aliases based on a generic for convenience? ex:

class Foo<T extends Stuff, U extends IDontWantToTypeThisHelperEveryTimeItsUsed<T> = IDontWantToTypeThisHelperEveryTimeItsUsed<T>>{

bar: U
baz: Asdf<U>
harr: PirateHelper<U>
....
}

will suffer from "U satisfies the constraint but could be instantiated with a different type" because of the extends. I just want to have extra aliases for conveneince, not actual extra type parameters
Was this page helpful?