で外部モジュールにアクセスすることができ、私はインターフェイスにアクセスしたい以下はどのように私はtypescriptです
ROOT /データベース/ models.ts
module Model {
export interface Inbox {
title: string;
msg: string;
}
export interface User{
Id: string;
Name: string;
}
}
のように私は、モジュールを含むファイルを持っていますメインファイルから。私は
ROOT /ページ/ main.ts
import { Model} from '../database/models'; //<-- here is my problem
export class WorkerPostbidPage {
myinbox:Model.Inbox; // <-- And I want to call it as this
TestMethod() {
this.myinbox = {
title:"new msg",
msg:"you have an alert"
}
}
}
しかし、試したものを見ることが正常に動作し、以下のように私はmain.tsに外部のモデルファイルの内容をコピーするとき
module Model {
export interface Inbox {
title: string;
msg: string;
}
export interface User{
Id: string;
Name: string;
}
}
export class WorkerPostbidPage {
myinbox:Model.Inbox; // <-- And I want to call it as this
TestMethod() {
this.myinbox = {
title:"new msg",
msg:"you have an alert"
}
}
}
私は何か間違っているかもしれないと思うか、いくつかの部分が欠けていると思います。
を動作するはずと仮定すると、私はそれを試してみました、と私はモデルの名前空間を介してそれらにアクセスすることはできませんなぜそのほか正しく –