Enum vs Union Types
Enum Vs Union
π¨βπΌ You've already created enums. Now let's migrate them to union types which is
the preferred approach in modern TypeScript.
The code already has an enum-based logging function. Your task is to create a
union-based version.
π¨ Open
and:
- Create a new function
logWithUnionthat uses an inline union type instead of theLogLevelenum - The union type should be:
'debug' | 'info' | 'warn' | 'error' - Export both functions so we can compare them
If you see an "experimental transform-types" warning when running this step,
that's from the workshop runtime and can be ignored.


