adaltas / node-stream-transform

Object transformations implementing the Node.js `stream.Transform` API
https://csv.js.org/transform/
49 stars 13 forks source link

TypeScript support #24

Closed statico closed 5 years ago

statico commented 5 years ago

It would be great to see TypeScript support for this module, either here or via https://github.com/DefinitelyTyped/DefinitelyTyped

Here are the types currently generated by VS Code, which definitely be more refined:

export = index
declare function index(...args: any[]): any
declare namespace index {
  class Transformer {
    constructor(options1: any, transform1: any)
    options: any
    transform: any
    running: any
    started: any
    finished: any
    addListener(ev: any, fn: any): any
    cork(): void
    destroy(err: any, cb: any): any
    emit(type: any, args: any): any
    end(chunk: any, encoding: any, cb: any): any
    eventNames(): any
    getMaxListeners(): any
    isPaused(): any
    listenerCount(type: any): any
    listeners(type: any): any
    off(type: any, listener: any): any
    on(ev: any, fn: any): any
    once(type: any, listener: any): any
    pause(): any
    pipe(dest: any, pipeOpts: any): any
    prependListener(type: any, listener: any): any
    prependOnceListener(type: any, listener: any): any
    push(chunk: any, encoding: any): any
    rawListeners(type: any): any
    read(n: any): any
    removeAllListeners(ev: any): any
    removeListener(ev: any, fn: any): any
    resume(): any
    setDefaultEncoding(encoding: any): any
    setEncoding(enc: any): any
    setMaxListeners(n: any): any
    uncork(): void
    unpipe(dest: any): any
    unshift(chunk: any): any
    wrap(stream: any): any
    write(chunk: any, encoding: any, cb: any): any
  }
}
wdavidw commented 5 years ago

The latest version 2.0.0 comes now with .d.ts definitions files and, if incomplete, shall hopefully provide the ground for future work. Please send us your feedback.

statico commented 5 years ago

Thank you!