d3.js - Angular2 / Typescript + D3v4 - manually include typings? -


i've been trying d3 , running angular2 app.
there seems issue new d3v4 , available typings file, i.e. trying use new methods such scalelinear() instead of no longer available scale.linear() result in error
property 'scalelinear' not exist on type 'typeof d3'.
 

since tomwanzek seems on issue , trying create new definitions on @ https://github.com/tomwanzek/d3-v4-definitelytyped wondering if there way manually include available typings files in angular2 project?

in reference arlo's answer, let me expand brief history , current answer. created repo https://github.com/tomwanzek/d3-v4-definitelytyped develop new d3 version 4 typescript definitions, when d3 v4 not yet final , typescript 2 on horizon. latter major factor, because changed way definitions written , can acquired, i.e. @types.

with few noted nods collaborators listed on repo, finalized definitions , migrated them definitelytyped. actively maintained in types-2.0 branch of definitelytyped. branch published npm @types.

some of confusion might have seen, had fact individual d3 v4 module definitions, e.g. d3-selection, had been available through npm install --save @types/d3-selection quite time. however, until yesterday definition acquired npm install --save @types/d3 still pulled down old d3 v3.5.x definition.

as of now, d3 v4 standard bundle definitions available from npm install --save @types/d3 (the legacy version definitions d3 v3.5 can still pulled @types acquiring 3.5 version if need be)

as using definitions imports:

  • do not install , use d3 standard bundle ('d3' , '@types/d3', respectively) while @ same time installing d3 modules contained in separately, e.g. 'd3-hierarchy' , '@types/d3-hierarchy'.

as angular 2, yes, d3-ng2-service or similar 1 way go. i'm sure there can improvements it, started rapid prototyping in conjunction angular-cli.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -