Typescript can't find modules

后端 未结 1 1688
慢半拍i
慢半拍i 2021-01-24 23:35

I have an exported module in one file(upload.ts) in Typescript that I\'m not able to import into another file(application.ts) without an error. Also, I\'m not able to import Exp

相关标签:
1条回答
  • 2021-01-24 23:57

    You need to:

    • make sure to put both express.d.ts and node.d.ts into your project directory, near your application files
    • import them into your application

    Example:

    /// <reference path="libs/express.d.ts" />
    /// <reference path="libs/node.d.ts" />
    
    import http = require("http");
    import express = require("express");
    import upload = require("Upload");
    
    var upload = new upload.Upload();
    var app = express();
    

    Upload module can be referenced in similar way. BTW, your code looks more like javascript then typescript

    0 讨论(0)
提交回复
热议问题