Git Product home page Git Product logo

Comments (3)

tomwanzek avatar tomwanzek commented on July 18, 2024

@niklas-dahl Thanks. I opened a separate issue to update the dependencies to support ng2 2.0.0 see #9 .
Fingers crossed, it's quick. But I am checking out a migration to angular-cli beta.14 out for other projects first today.

As for your question related to using the typings for D3v4 here is a short version of what is shining through in the longer tracking issue on DT you referenced above:

(1) Yes, the definitions pulled from @types/d3 are still for D3 3.x. There is no single definitions file for the D3 Standard Bundle v4 in DT/types-2.0 and @types yet. This is due to a structural limitation in the DT/types-2.0 branch, which does not yet support parallel versions. This is a known issue with the TS team building the types-publisher linking DT and @types. We cannot kill the legacy version due to the dependencies to it from other libraries in DT.

(2) All the D3 modules which form part of the D3 Standard Bundle are, however, obtainable from @types. E.g. npm install @types/d3-selection --save will get you the latest v4 definitions for d3-selection. So you can import them individually and bundle them similar to how this d3-ng2-service does it in bundle-d3.ts. You can also just use a subset, to fit your tailored need.

If you require the use of a d3 global for vanilla scripts, things are still a little tricky. You can essentially follow the approach under (2), with a couple of changes:

  • Rather than building a .ts file use a .d.ts file (i.e. you creating your own bundle definition in the project
  • Add the following to the so created bundle definitions file: export as namespace d3;

The last part will ensure the global becomes available. You can consume it in a TS file by using

\\\ <reference types="..." />

with the appropriate path to the bundle definitions file. This would be used instead of an import statement.

As I finalize the transition of issues/open items from the repo in which the new definitions were developed to DT, I will restructure the main issue thread you found. For some open items I will post a temporary work around, as long as there are still dependencies.

Hope this helps in the meantime. I will cc you, when I update the DT comments.

In the interim, if you have questions related to the types more general rather than specific to this service, it may be easier to post them on DT (use the main issue for now). I'm sure you are not the only one who ran into the current structural limitations.

Cheers. 😄

from d3-ng2-service.

niklas-dahl avatar niklas-dahl commented on July 18, 2024

wow, thanks for your detailed answer.

from d3-ng2-service.

tomwanzek avatar tomwanzek commented on July 18, 2024

Not to worry. PS. you're good to use it with ng2 v2.0.0 now. All (peer)-dependencies are updated in the latest release 1.1.3. Will convert the demo project linked in the README next (but that is predicated on all going well with the latest angular-cli release...)

from d3-ng2-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.