From f85918e808429ac707f03dce4cc3042de60b27f7 Mon Sep 17 00:00:00 2001 From: Fabian Wiles Date: Sun, 9 Feb 2020 15:20:12 +1300 Subject: [PATCH] feat: adds TypeScript definitions fixes #195 --- index.d.ts | 23 +++++++++++++++++++++++ index.js | 1 + package.json | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 index.d.ts create mode 100644 index.js diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..04f3be6f --- /dev/null +++ b/index.d.ts @@ -0,0 +1,23 @@ +export type Watermark = [number, number]; + +export declare class Report { + constructor(opts: { + exclude?: any[], + include?: any[], + reporter: string[], + reportsDirectory?: string, + tempDirectory?: string, + watermarks?: Partial<{ + statements: Watermark; + functions: Watermark; + branches: Watermark; + lines: Watermark; + }>, + omitRelative?: boolean, + wrapperLength?: number, + resolve?: string, + all?: boolean, + }) + + run(): Promise; +} \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 00000000..b35287aa --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +exports.Report = require('./lib/report') diff --git a/package.json b/package.json index 09512d4a..ab51b40c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "c8", "version": "7.0.1", "description": "output coverage reports using Node.js' built in coverage", - "main": "index.js", + "main": "./index.js", + "types": "./index.d.ts", "bin": "./bin/c8.js", "repository": { "type": "git", @@ -58,6 +59,8 @@ "node": ">=10.12.0" }, "files": [ + "index.js", + "index.d.ts", "lib", "bin", "LICENSE"