Effect CommunityEC
Effect Community3y ago
39 replies
Kristian Notari

Using Interfaces to Obscure Non-Object Types in TypeScript

Do you know if there's a way to have non object types be obscured behind a name with an interface instead of seeing a big union type all over the place?

I have:
type MyString = 'a' | 'b' | 'c'
const a: MyString = 'a'
// typeof a = 'a' | 'b' | 'c'
// but I'd like it to read as typeof a = MyString

on hovers/hints and stuff like that
Was this page helpful?