tomwanzek / d3-v4-definitelytyped

[DEPRECATED] This repo was intended as a staging area for typescript definitions supporting the latest major release of D3js (i.e. version 4.1.x) by Mike Bostock. It has been migrated to DefinitelyTyped.
MIT License
53 stars 14 forks source link

Individual module/methods import #92

Closed Ledragon closed 8 years ago

Ledragon commented 8 years ago

Using these new types, is it possible to import individual modules/methods in files?

I tend to not use the standard bundle and pick what I use on a file-by-file basis, doing things like:

import { select } from 'd3-selection';

This does not seem to be working currently... Am I missing something with the new @types way of doing things, or should the declarations be adapted to be able to account for that use case?

Typings installed using typings are wrapped in declared modules, and then reexported, like:

declare module '~d3-selection/index' {
    ///module definition
}
declare module 'd3-selection/index' {
    export * from '~d3-selection/index';
}
declare module 'd3-selection' {
    export * from '~d3-selection/index';
}

Is it something that should/will/would be done here as well? I am not so familiar with the way modules and typings recognition work, so it might just be a wrong way of using things...

Ledragon commented 8 years ago

My bad, wrong compiler was being used. Managed to get it working. And got it working in VS Code, thanks to this article.