Enhance definition for heapdump (#24927)

* Enhance definition and according tests for heapdump

* Add changes to fix the CI
This commit is contained in:
Arne Schubert
2018-04-16 17:43:33 -07:00
committed by Ryan Cavanaugh
parent 0bab723bac
commit ed43fdd5b7
2 changed files with 20 additions and 7 deletions
+17 -6
View File
@@ -1,9 +1,20 @@
import * as heapdump from 'heapdump';
heapdump.writeSnapshot('/tmp/myDump', (err) => {
if (err) {
console.log('Failed to dump heap: ' + err);
} else {
console.log('Successfully dumped heap!');
}
let strValue = "";
let errValue = new Error(strValue);
let nullValue = null;
let undefinedValue;
heapdump.writeSnapshot(strValue, (err, filename) => {
errValue = err as Error;
nullValue = err as null;
strValue = filename as string;
undefinedValue = filename as undefined;
});
heapdump.writeSnapshot((err, filename) => {
errValue = err as Error;
nullValue = err as null;
strValue = filename as string;
undefinedValue = filename as undefined;
});
+3 -1
View File
@@ -2,5 +2,7 @@
// Project: https://github.com/bnoordhuis/node-heapdump
// Definitions by: weekens <https://github.com/weekens>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export function writeSnapshot(dumpFileName: string, callback: (err?: Error) => void): void;
export function writeSnapshot(dumpFileName?: string, callback?: (err: Error | null, filename: string | undefined) => void): void;
export function writeSnapshot(callback: (err: Error | null, filename: string | undefined) => void): void;