Merge pull request #13538 from max4t/master

[verror] strictNullChecking and possible null/undefined to VErrorOptions
This commit is contained in:
Andy
2016-12-29 11:59:18 -05:00
committed by GitHub
3 changed files with 15 additions and 13 deletions
+9 -9
View File
@@ -1,16 +1,19 @@
// Type definitions for verror v1.9.0
// Type definitions for verror 1.9
// Project: https://github.com/davepacheco/node-verror
// Definitions by: Sven Reglitzki <https://github.com/svi3c/>
// Definitions by: Sven Reglitzki <https://github.com/svi3c/>, Maxime Toumi-M <https://github.com/max4t/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type VErrorInfo = { [key: string]: any };
// tslint:disable-next-line:functional-interfaces
interface VErrorInfo {
[key: string]: any;
}
declare interface VErrorOptions {
cause: Error;
cause?: Error | null | undefined;
name?: string;
strict?: boolean;
constructorOpt?: Function;
constructorOpt?: (...args: any[]) => void;
info?: VErrorInfo;
}
@@ -70,10 +73,7 @@ declare class MultiError extends VError {
* is wrapped, not "folded in" as with VError. Accepts a printf-style message.
* The cause argument can be null.
*/
declare class WError extends Error {
cause(): Error;
constructor(cause: Error, message: string, ...params: any[]);
constructor(message: string, ...params: any[]);
declare class WError extends VError {
}
export = VError;
+2 -2
View File
@@ -4,7 +4,7 @@
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -17,4 +17,4 @@
"index.d.ts",
"verror-tests.ts"
]
}
}
+4 -2
View File
@@ -21,8 +21,10 @@ var verror3 = new VError({
}
}, "bar");
var cause1: Error = verror1.cause();
var cause2: Error = werror.cause();
var verror4 = new VError({ cause: null }, "bar");
var cause1: Error | undefined = verror1.cause();
var cause2: Error | undefined = werror.cause();
const info: { [k: string]: any } = VError.info(verror3);
const namedCause: Error | null = VError.findCauseByName(verror3, "fooError");