Code Monkey home page Code Monkey logo

npm-d3's Introduction

Typed d3

The type definition for d3.

License

MIT

npm-d3's People

Contributors

c9s avatar patrickjs avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

twastvedt

npm-d3's Issues

typed-d3 vs DefinitelyTyped/d3

At the time of writing, the diff between the type definition in this repo and that on DefinitelyTyped is:

--- DefinitelyTyped/d3/d3.d.ts  2015-12-02 10:18:19.698205131 +0000
+++ typings/typed-d3/index.d.ts 2015-12-02 10:02:38.989999203 +0000
@@ -2697,24 +2697,24 @@
         response(): (request: XMLHttpRequest) => any;
         response(value: (request: XMLHttpRequest) => any): DsvXhr<T>;

-        get(callback?: (err: XMLHttpRequest, data: T[]) => void): DsvXhr<T>;
-        post(data?: any, callback?: (err: XMLHttpRequest, data: T[]) => void): DsvXhr<T>;
-        post(callback: (err: XMLHttpRequest, data: T[]) => void): DsvXhr<T>;
+    get(callback?: (err: any, data: T) => void): DsvXhr<T>;
+    post(data?: any, callback?: (err: any, data: T) => void): DsvXhr<T>;
+    post(callback: (err: any, data: T) => void): DsvXhr<T>;

-        send(method: string, data?: any, callback?: (err: XMLHttpRequest, data: T[]) => void): DsvXhr<T>;
-        send(method: string, callback: (err: XMLHttpRequest, data: T[]) => void): DsvXhr<T>;
+    send(method: string, data?: any, callback?: (err: any, data: T) => void): DsvXhr<T>;
+    send(method: string, callback: (err: any, data: T) => void): DsvXhr<T>;

         abort(): DsvXhr<T>;

         on(type: "beforesend"): (request: XMLHttpRequest) => void;
         on(type: "progress"): (request: XMLHttpRequest) => void;
-        on(type: "load"): (response: T[]) => void;
+    on(type: "load"): (response: T) => void;
         on(type: "error"): (err: any) => void;
         on(type: string): (...args: any[]) => void;

         on(type: "beforesend", listener: (request: XMLHttpRequest) => void): DsvXhr<T>;
         on(type: "progress", listener: (request: XMLHttpRequest) => void): DsvXhr<T>;
-        on(type: "load", listener: (response: T[]) => void): DsvXhr<T>;
+    on(type: "load", listener: (response: T) => void): DsvXhr<T>;
         on(type: "error", listener: (err: any) => void): DsvXhr<T>;
         on(type: string, listener: (...args: any[]) => void): DsvXhr<T>;
     }
@@ -3313,6 +3313,4 @@
 // we need this to exist
 interface TouchList { }

-declare module 'd3' {
     export = d3;
-}

This highlights the fact that this repo's copy has fallen behind in a couple of places.... and because there are two places to update, that is always a possibility.

But ignoring that for one second, the two are largely identical (and intended as such) with the exception of:

-declare module 'd3' {
     export = d3;
-}

Why not split the DefinitelyTyped definition and drop the copy in this repo, thereby creating a single place for modifying what is essentially a shared definition?

I've pushed up an example of what I mean: https://github.com/myitcv/DefinitelyTyped/tree/d3_split_example/d3

The typings registry would then reference the d3-typings.d.ts file (which would transitively pull in d3-common.d.ts).

Thoughts?

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.