I am converting my express nodejs project from JS to TypeScript. I renamed the file extension, changed var to import for "require()" , however there is one thing that is working and is undefined, express.Router().
import express = require('express');
var router = express.Router(); // Undefined
import mongoose = require('mongoose');
What should I do to resolve it?!
First, in you project directory, you need to install typings
npm install -g typings
Then, install the typing destination for expressJS
typings install express --ambient --save
This will create a typings.json and should fix your problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.