0
在打字稿,具有两个类作为显示下:打字稿 - Propertie包括类
Oferta.ts:
module Ofertas{
export class Oferta {
VMVivienda: Ofertas.Vivienda();
constructor(){
this.VMVivienda = new Ofertas.Vivienda();
}
}
}
Vivienda.ts
module Ofertas{
export class Vivienda {
viviendaID: number;
constructor(){
this.viviendaID = 0;
}
}
}
编译时,控制台抛出错误:
error TS0294: The property 'Vivienda' does not exist on value of type 'typeof Ofertas'
这是您的问题'VMVivienda:Ofertas.Vivienda();'中的错字。它应该是'VMVivienda:Ofertas.Vivienda;'即使在修复该行时,编译时也不会收到错误 – Jehof 2014-10-17 10:49:18
编译器返回相同的错误。这很奇怪,intellisense不显示任何错误.... – 2014-10-17 10:57:08
你不一定需要用Vivienas加Ofertas。它(Oferta)应该已经在该名称空间中。我不知道它是否能解决这个错误,但你的代码会更紧凑。除了@Jehof提到的错字之外,我不知道是什么原因导致错误。 – Gustav 2014-10-17 11:41:55