Using Public Variables And Interfaces In External Libraries When Using Typescript
I am fairly new to Typescript and am developing an Angular 2.0/Typescript application. I have made d3 available as a typing and I would like to use public methods from D3 as well a
Solution 1:
How do I make both "d3" and "D3" available for usage without the Typescript transpiler throwing any errors?
You seem to want to use community written d3 defintions. In that case you should not add your own i.e. don't have declare var d3
anywhere in your code. This should come with d3.d.ts
available here : https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/d3
More
You can install it using typings typings install d3 --ambient --save
. Also if you are using a module system use import * as d3 from "d3"
e.g. in alm.tools I have https://github.com/alm-tools/alm/blob/894a6f095ecc84c8e32adf79c1bb7d595eba877d/src/app/tabs/dependencyView.tsx#L8
Post a Comment for "Using Public Variables And Interfaces In External Libraries When Using Typescript"