// TypeLite.Net4.d.ts declare namespace MyNamespace.Models { interface InvoiceModel { billingPeriodId: number; createdDate: Date; invoiceId: number; invoiceNumber: number; organizationId: number; paidDate: Date; total: number; } }
我想用这个文件在我的角度项目,但我似乎找不到一个很好的解释如何做到这一点。我尝试了很多我在网上找到的东西,包括把它添加到我的 tsconfig.json 在 files include typeRoots 但是我还没有找到正确的方法。不管我做什么,我还是会出错 TS2304: Cannot find name 'InvoiceModel' . 我该怎么做?
tsconfig.json
files
include
typeRoots
TS2304: Cannot find name 'InvoiceModel'
因为您还没有发布使用生成的typescript声明文件的代码段,所以请考虑问题的这一部分
我尝试了在网上找到的各种方法,包括将其添加到>我的tsconfig.json文件在“文件”、“包含”或“类型根”部分中“
我推断你不知何故遗漏了对声明文件的引用。这就是我的工作 tripple-slash-directives .
/// reference path=".../path/to/file" />