0
我有声明文件module.d.ts打字稿模块加载错误
declare module "ArrayItem" {import out = require("models/ArrayItem"); export = out;}
现在我有一个文件Array.ts和第一行是
/// <reference path="../module.d.ts" />
import array = require("ArrayItem").
但是,这是行不通的。我得到脚本错误。
如果我使用,
/// <reference path="../module.d.ts" />
import array = require("models/ArrayItem")
然后,我没有得到任何错误。
模块加载在这里有什么问题?
如果我有一个module.d.ts,那么应该从require(“arrayitem”)加载arrayitem模块。
对不起?或者我应该总是ArrayItem的正确路径?
我很困惑。有人可以在这里帮忙吗?
ok..so我应该总是说import array = require(“models/ArrayItem”),即使我有module.d.ts文件?你能否详细说明我应该在这里做什么? – user2325247
您有一个参考其他打字稿模块的打字稿模块,因此不需要使用module.d.ts。如果你在打字稿中使用JavaScript库,你只会这样做。 –
明白了......我必须做出一些改变。谢谢, – user2325247