Let say I have a variable with the following type:
let weekDay: 'Sun' | 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat';
And in different places in my project I'm using this type, so each time I write:
function setDay(day: 'Sun' | 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat') { ... }
function getDay(): 'Sun' | 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat' { ... }
How can I define this new type once, so I will not need to write it each time. I try to define an interface
but it will create an object-type with this type as one of each attributes, but this isn't what I want
interface iWeekDay {
day: 'Sun' | 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat';
}