Merge pull request #26292 from thomasthiebaud/add-serialize-error-npm-module

Add type definition for serialize-error
This commit is contained in:
Armando Aguirre
2018-06-07 12:47:36 -07:00
committed by GitHub
4 changed files with 46 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for serialize-error 2.1
// Project: https://github.com/sindresorhus/serialize-error
// Definitions by: Thomas Thiebaud <https://github.com/thomasthiebaud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function SerializeError(error: any): SerializeError.ErrorObject;
declare namespace SerializeError {
interface ErrorObject {
name: string;
stack: string;
message: string;
[keyof: string]: string;
}
}
export = SerializeError;
@@ -0,0 +1,5 @@
import serializeError = require('serialize-error');
const error = new Error('unicorn');
const serializedError = serializeError(error);
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"serialize-error-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }