Skip to content

Commit

Permalink
Attempt to provide custom type mappings for remap-istanbul
Browse files Browse the repository at this point in the history
Attempt to provide custom type mappings for remap-istanbul, inspired by:
SitePen/remap-istanbul#155 (comment)
  • Loading branch information
asbjornu committed Dec 1, 2020
1 parent 7b8816c commit 32e3d7f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
41 changes: 41 additions & 0 deletions src/types/remap-istanbul/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
declare module 'remap-istanbul' {
namespace RemapIstanbul {
export interface Options {
fail?: boolean;
check?: CheckOptions;
reportOpts?: {};
reports?: {};
}

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

export interface Thresholds {
statements: Number;
branches: Number;
lines: Number;
functions: Number;
excludes: string[];
}

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

export default class {
/**
* The basic API for utilising remap-istanbul
* @param {Array|string} sources The sources that could be consumed and remapped.
* For muliple sources to be combined together, provide
* an array of strings.
* @param {Object} reports An object where each key is the report type required and the value
* is the destination for the report.
* @param {Object} reportOptions? An object containing the report options.
* @return {Promise} A promise that will resolve when all the reports are written.
*/
public remap(sources: [], reports: object, reportOptions: RemapIstanbul.Options): any;
}
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
"strict": true, /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
"typeRoots": ["./src/types", "./node_modules/@types"]
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit 32e3d7f

Please sign in to comment.