i'm working in project , need load module not in typescript. in folder called typings have typescript modules while in folder node_modules have javascript version. problem when try import module not found. how can solve issue?
in typings don't have implementation of module in typescript type definitions of javascript module (which might in node_modules). see definitelytyped.org/ more information.
you can install type definitions of mudule with
$ tsd query package_name -a install --save with command tsd.json file updated , when execute tsd reinstall, package installed again. that's nice if other people working on project. can install type definitions tsd reinstall (as long tsd.json in repository).
in .ts file import javascript module
import module = require ('module'); and load type definitions
/// <reference path="../../../typings/module/module.d.ts" /> of course have adapt path , names. if don't have type definitions, can load javascript module with
declare var require: any; var module = require('module');
Comments
Post a Comment