简体   繁体   中英

How to import npm packages from a typescript project?

I have this in my typescript project

import * as schedule from "node-schedule";
import * as ACTIONS from "../../../actions";

The bottom one resolves, but the top one does not. It is a node package I got from doing npm install node-schedule . I get

Cannot find module 'node-schedule' or its corresponding type declarations.ts(2307)

How can I import that?

You need to install its types package..

npm install --save @types/node-schedule

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM