Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Installing from github: issue referencing d3-selection #93

Closed
spiffytech opened this issue Aug 11, 2016 · 3 comments
Closed

Installing from github: issue referencing d3-selection #93

spiffytech opened this issue Aug 11, 2016 · 3 comments

Comments

@spiffytech
Copy link

Since DefinitelyTyped branch types-2.0 doesn't look deployed yet, I'm trying to install the v4 typings directly from GitHub. typings is getting confused by d3-zoom and d3-drag's reference to d3-selection, since it's not correctly guessing d3-selection is a folder it should peek inside of.

$ typings install --save-dev "github:tomwanzek/d3-v4-definitelytyped/src/d3-drag#47eae6d" 
typings ERR! message Unable to read "../d3-selection.d.ts" from "d3-drag".
You should validate all import paths are accurate (case sensitive and relative)

typings ERR! caused by 
https://raw.githubusercontent.com/tomwanzek/d3-v4-definitelytyped/47eae6d/src/d3-selection.d.ts
responded with 404, expected it to equal 200

The following fix inside d3-drag & d3-zoom works locally:

- import { ArrayLike, Selection, TransitionLike, ValueFn } from '../d3-selection';
+ import { ArrayLike, Selection, TransitionLike, ValueFn } from '../d3-selection/index';`

Is this fix acceptable (I can submit a PR). Else, is there a better way to get the v4 definitions before DT has caught up?

@tomwanzek
Copy link
Owner

@spiffytech The vast majority of the individual modules are now available through the @types organization in their first version. The key exceptions are d3-dsv, d3-request and the definition file for the the standard D3 bundle d3. These are currently in a PR on DefinitelyTyped, as a couple of transition issues need to be addressed with respect to legacy version definitions for d3 (version 3.5.17) and d3-dsv. Hopefully, they can be resolved in a timely matter.

If you have a look at the Module-Level Status section of the README, you will find an updated status. Where in initial version is available on @types, you can simply install the definition with e.g.

npm install @types/d3-selection --save

When you install them this way, TS2 will resolve the definitions correctly without any need for typings to be used.

I will in short order push a few minor follow-ups through a PR to these initial files, which will eventually also propagate to @types.

In turn, while I appreciate your comment and the offered PR, the above should address your issue.
(Assuming you are using D3 modules in a module import pattern and not as vanilla scripts with the d3 global. In which case, I am already tracking an issue for the vanilla script scenario.)

So I would prefer not to make the change to this repo at present. Provided all migration related issues can be addressed satisfactorily, there should be no need for it. I would only consider restructuring this repo for "production use", if a material issue cannot be addressed with DefinitelyTyped being the primary source (feeding @types).

@spiffytech
Copy link
Author

Ah, TIL. I misunderstood the relationship between typings and @types, and got confused when typings search showed some, but not all, d3 typings available from npm.

I've installed directly from npm as you directed, and all is well. Thanks!

@mark3448
Copy link

mark3448 commented Sep 6, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants