グローバル型と同じ名前の型があります。具体的には、イベント。TypeScript同じ型の名前空間内でグローバル型を使用する
私はイベントをネームスペース内に置いています。ネームスペース内でイベントを参照するのは簡単ですが、ネームスペース内ではグローバル(または標準)イベントを参照することはできません。
namespace Dot {
export class Event {
// a thing happens between two parties; nothing to do with JS Event
}
function doStuff(e : Event) {
// Event is presumed to be a Dot.Event instead of usual JS event
// Unable to refer to global type?
}
}
function doStuff2(e : Event) {
// Use of regular Event type, cool
}
function doStuff3(e : Dot.Event) {
// Use of Dot event type, cool
}
これは単純には不可能だと思われますが、これは確認できますか? Dot.Event型の名前を変更する以外の回避策はありますか?
乾杯
関連:https://github.com/Microsoft/TypeScript/issues/983 – xmojmr