angular - How do I import from a `.d.ts` file? -


this line works in project uses angular2 rc4

import * maptypes '../../../../node_modules/angular2-google-maps/core/services/google-maps-types.d.ts';

what's happening?

now trying new seed file rc6 , same line gives me error

error ts2691: import path cannot end '.d.ts' extension. consider importing '../../../../node_modules/angular2-google-maps/core/services/google-maps-types' instead.

but if make suggested change,

cannot find module '../../../../node_modules/angular2-google-maps/core/services/google-maps-types'

the .d.ts file looks this:

/**  * angular2-google-maps - angular 2 components google maps  * @version v0.12.0  * @link https://github.com/sebastianm/angular2-google-maps#readme  * @license mit  */ export declare var google: any; export interface googlemap {     constructor(el: htmlelement, opts?: mapoptions): void;     panto(latlng: latlng | latlngliteral): void;     setzoom(zoom: number): void;     addlistener(eventname: string, fn: function): void;     getcenter(): latlng;     setcenter(latlng: latlng | latlngliteral): void;     getbounds(): latlngbounds;     getzoom(): number;     setoptions(options: mapoptions): void; } ... 

and matching .ts file looks like

/**  * angular2-google-maps - angular 2 components google maps  * @version v0.12.0  * @link https://github.com/sebastianm/angular2-google-maps#readme  * @license mit  */ "use strict";  //# sourcemappingurl=google-maps-types.js.map 

note: there newer version of package matched rc6, should able @ least compile in ts

if you're using last versions of typescript , typing definition embedded in npm package, can import module :

import { googlemap } 'angular2-google-maps/core/services/google-maps-types' 

even if it's interface.

in fact you're importing definition core/services/googles-maps-types.js, file exists provide definition associated in .d.ts file.

it's been made work if importing directly .ts file, you're in npm module, embed definition file permit definitions imports.



Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -