diff --git a/types/standard-error/index.d.ts b/types/standard-error/index.d.ts index c729b5ce66..4bdf04c33e 100644 --- a/types/standard-error/index.d.ts +++ b/types/standard-error/index.d.ts @@ -3,19 +3,13 @@ // Definitions by: Labat Robin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'standard-error' { - const StandardError: StandardError.constructor; +// TypeScript Version: 2.2 - namespace StandardError { - interface constructor { - new (message: string, props?: object): error; - new (props: object): error; - } +export = StandardError; - interface error extends Error { - [key: string]: any; - } - } +declare class StandardError extends Error { + [key: string]: any; - export = StandardError; -} \ No newline at end of file + constructor(message: string, props?: any); + constructor(props: any); +} diff --git a/types/standard-error/standard-error-tests.ts b/types/standard-error/standard-error-tests.ts index 9f17c4fc96..a5184da531 100644 --- a/types/standard-error/standard-error-tests.ts +++ b/types/standard-error/standard-error-tests.ts @@ -1,13 +1,13 @@ -import * as StandardError from 'standard-error'; +import StandardError = require('standard-error'); -let error = new StandardError('test'); //$ExpectType StandardError.error +let error = new StandardError('test'); // $ExpectType StandardError -error.message; //$ExpectType string -error.name; //$ExpectType string -error.stack; //$ExpectType string +error.message; // $ExpectType string +error.name; // $ExpectType string +error.stack; // $ExpectType string | undefined -error = new StandardError({ name: 'test', foo: 'bar' }); //$ExpectType StandardError.error +error = new StandardError({ name: 'test', foo: 'bar' }); // $ExpectType StandardError -error.foo; //$ExpectType any +error.foo; // $ExpectType any -error = new StandardError('test', { foo: 'bar' }); //$ExpectType StandardError.error \ No newline at end of file +error = new StandardError('test', { foo: 'bar' }); // $ExpectType StandardError diff --git a/types/standard-http-error/index.d.ts b/types/standard-http-error/index.d.ts index 14f72ea9a8..9b95acebeb 100644 --- a/types/standard-http-error/index.d.ts +++ b/types/standard-http-error/index.d.ts @@ -3,24 +3,15 @@ // Definitions by: Labat Robin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +// TypeScript Version: 2.2 -declare module 'standard-http-error' { - import * as StandardError from 'standard-error'; +import StandardError = require('standard-error'); - const HttpError: HttpError.constructor; +export = HttpError; - namespace HttpError { - interface constructor { - new (code: number | string, message?: string, props?: object): error; - new (code: number | string, props?: object): error; - [key: string]: number | undefined; - } +declare class HttpError extends StandardError { + code: number; - interface error extends StandardError.error { - code: number; - } - } - - export = HttpError; -} \ No newline at end of file + constructor(code: number | string, message?: string, props?: object); + constructor(code: number | string, props?: object); +} diff --git a/types/standard-http-error/standard-http-error-tests.ts b/types/standard-http-error/standard-http-error-tests.ts index 872bc3410d..0b430774d2 100644 --- a/types/standard-http-error/standard-http-error-tests.ts +++ b/types/standard-http-error/standard-http-error-tests.ts @@ -1,16 +1,16 @@ -import * as HttpError from 'standard-http-error'; +import HttpError = require('standard-http-error'); -let error = new HttpError(200); //$ExpectType HttpError.error +let error = new HttpError(200); // $ExpectType HttpError -error.code; //$ExpectType number -error.message; //$ExpectType string -error.name; //$ExpectType string -error.stack; //$ExpectType string +error.code; // $ExpectType number +error.message; // $ExpectType string +error.name; // $ExpectType string +error.stack; // $ExpectType string | undefined -error = new HttpError(200, 'test'); //$ExpectType HttpError.error -error = new HttpError('OK', 'test'); //$ExpectType HttpError.error -error = new HttpError(200, 'test', { foo: 'bar' }); //$ExpectType HttpError.error +error = new HttpError(200, 'test'); // $ExpectType HttpError +error = new HttpError('OK', 'test'); // $ExpectType HttpError +error = new HttpError(200, 'test', { foo: 'bar' }); // $ExpectType HttpError -error.foo; //$ExpectType any +error.foo; // $ExpectType any -error = new HttpError(200, { message: 'test', foo: 'bar' }); //$ExpectType HttpError.error \ No newline at end of file +error = new HttpError(200, { message: 'test', foo: 'bar' }); // $ExpectType HttpError