Closed
Description
module foo {
export function on(event: string|Event) {
if (typeof event === "string") {
event = new Event(event) // (a)
event = new Event(String(event)) // (b)
}
console.log(event.target)
}
class Event {
constructor(name: string) {}
}
}
Is this a bug, known issue?
Using the latest tsc from master, get the errors:
(a) error TS2345: Argument of type 'string | Event' is not assignable to parameter of type 'string'.
(b) error TS2339: Property 'target' does not exist on type 'string | Event'.