npm i moment
After the download is complete the moment, introduced in ts file
import * as moment from "moment";
The results mad error, moment module not found.
Ts first thought is the lack of definition files, would like to direct download npm i @types/moment
, it's still not finished after the next, the official website open a search, said that moment the module already has its own type definitions file, do not download
Open node_modules / moment to look, there really is
But that is not so in ts, and began frantically Baidu.
After a pass operation, see an answer, roughly its own definition file that moment may still have a problem, still need maintenance
At this point I:
He also gives a solution, using the unified management of these statements typings file
npm i typings
After the download is complete the project appear in a folder typingstypings install dt~moment --global --save
Download the moment of definition files. Once downloaded, the error resolved