전역 유형과 동일한 형식의 유형이 있습니다. 특히, 이벤트.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