[英]Accessing interface/class of a nested module in TypeScript
我有一個包含內部模塊的TS模塊,例如:
module abc.customer.ratings {
module abc.customer.ratings.bo {
export interface RatingScale {
id: number;
name: string;
type: string;
}
}
var scale: ??? // how to name the inner interface here?
}
我嘗試使用:
RatingScale
,只是名字- 失敗 bo.RatingScale
內部模塊名稱(如相對路徑)+僅名稱- 失敗 abc.customer.ratings.bo.RatingScale
從世界開始的完整模塊路徑- 起作用 我的問題是-我可以用更短的方式使用它嗎,因為有效的方法確實很冗長。
在此代碼中:
module abc.customer.ratings {
module abc.customer.ratings.bo {
export interface RatingScale {
id: number;
name: string;
type: string;
}
}
var scale: ??? // how to name the inner interface here?
}
RatingScale
的標准名稱是abc.customer.ratings.abc.customer.ratings.bo.RatingScale
。 您可能想寫的是:
module abc.customer.ratings {
module bo {
export interface RatingScale {
id: number;
name: string;
type: string;
}
}
var scale: bo.RatingScale;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.