mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
add standard-error typings
This commit is contained in:
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for standard-error 1.1
|
||||
// Project: https://github.com/moll/js-standard-error
|
||||
// Definitions by: Labat Robin <https://github.com/roblabat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'standard-error' {
|
||||
const StandardError: StandardError.constructor;
|
||||
|
||||
namespace StandardError {
|
||||
interface constructor {
|
||||
new (message: string, props?: object): error;
|
||||
new (props: object): error;
|
||||
}
|
||||
|
||||
interface error extends Error {
|
||||
[key: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
export = StandardError;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import * as StandardError from 'standard-error';
|
||||
|
||||
let error = new StandardError('test'); //$ExpectType StandardError.error
|
||||
|
||||
error.message; //$ExpectType string
|
||||
error.name; //$ExpectType string
|
||||
error.stack; //$ExpectType string
|
||||
|
||||
error = new StandardError({ name: 'test', foo: 'bar' }); //$ExpectType StandardError.error
|
||||
|
||||
error.foo; //$ExpectType any
|
||||
|
||||
error = new StandardError('test', { foo: 'bar' }); //$ExpectType StandardError.error
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"standard-error-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user