type Reservation = {
}
type Reserve = {
(from: Date, to: Date, destination: string): Reservation
(from: Date, destination: string): Reservation
}
let reserve: Reserve = (from, toORDestination, destination?) => {
return {}
}
const a1 = reserve(new Date(), new Date(), 'c')
type CreateElement = {
(tag: 'a'): HTMLAnchorElement
(tag: 'canvas'): HTMLCanvasElement
(tag: 'table'): HTMLTableElement
(tag: string): HTMLElement
}
let createElement = (tag: string): HTMLElement => {
return
}
function createElement(tag: 'a'): HTMLAnchorElement
function createElement(tag: 'canvas'): HTMLCanvasElement
function createElement(tag: 'table'): HTMLTableElement
function createElement(tag: string): HTMLElement {
return
}
type WarnUser = {
(warning: string): void
wasCalled: boolean
}
const warnUser: WarnUser = (warning) => {
if(warnUser.wasCalled) {
return
}
warnUser.wasCalled = true
alert(warning)
}
warnUser.wasCalled = false