Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typescript typings for remap-istanbul #155

Open
silkentrance opened this issue Dec 4, 2017 · 2 comments
Open

Add typescript typings for remap-istanbul #155

silkentrance opened this issue Dec 4, 2017 · 2 comments
Milestone

Comments

@silkentrance
Copy link

I am currently working on building up a suite of gulp tasks and a gulpfile that are all implemented using typescript. For this, I use the compiler option "noImplicitAny": true.

Using that options will cause typescript to fail to compile my existing tasks that use remap-istanbul, as there is no type information for remap-istanbul available.

While I could define such typings myself, I'd rather would like these to be included directly into the package, so that I can reuse these typings from where ever I like. And others might also want this.

While one could publish the typings over at definitely typed, this would require a second party to maintain these typings, which is kind of counter productive.

What do you think?

@silkentrance
Copy link
Author

silkentrance commented Dec 5, 2017

An initial first stab at this would be to include gulpRemapIstanbul.d.ts in both lib/ and src/, e.g.

/// <reference types="node"/>

declare function RemapIstanbul(opts : RemapIstanbul.Options = {}) : NodeJS.ReadWriteStream;

declare namespace RemapIstanbul {
  interface Options {
    fail? : boolean;
    check?: CheckOptions;
    reportOpts?: {};
    reports?: {};
  }

  interface CheckOptions {
    global?: Thresholds;
    each?: EachThresholds;
  }

  interface Thresholds {
    statements: int = 0;
    branches: int = 0;
    lines: int = 0;
    functions: int = 0;
    excludes: string[] = [];
  }

  interface EachThresholds extends Thresholds {
    overrides?: {};
  }
}

export = RemapIstanbul;

@demurgos
Copy link
Contributor

Thanks for working on this, it's a good thing.
Since you're writing definitions for the package, it's good that you use external module definitions but you should leave out the Node reference. Add @types/node as a devDependency because it's an environment package.

@dylans dylans added this to the 0.12.0 milestone Apr 8, 2018
@dylans dylans modified the milestones: 0.12.0, 0.13.0, 0.14.0 Jan 8, 2019
asbjornu added a commit to remarkjs/vscode-remark that referenced this issue Dec 1, 2020
Attempt to provide custom type mappings for remap-istanbul, inspired by:
SitePen/remap-istanbul#155 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants