|
|
|
|
|
by adpirz
399 days ago
|
|
It's hard to unpack without knowing more about the use case, but adding discriminant properties (e.g. "user_type") to all the types in the union can make it easier to handle the general and specific case. E.g. if (user.user_type === 'authenticated') { // do something with user.name because the type system knows we have that now
}
|
|