[extract-stack] add typings (#18804)

This commit is contained in:
Dimitri Benin
2017-08-10 16:52:13 -07:00
committed by Mohamed Hegazy
parent 15196fb8bb
commit dea21dbe47
4 changed files with 43 additions and 0 deletions
@@ -0,0 +1,8 @@
import extractStack = require('extract-stack');
const error = new Error('Missing unicorn');
extractStack(error); // $ExpectType string
extractStack(error.stack); // $ExpectType string
extractStack.lines(error); // $ExpectType string[]
extractStack.lines(error.stack); // $ExpectType string[]
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for extract-stack 1.0
// Project: https://github.com/sindresorhus/extract-stack#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = extractStack;
declare function extractStack(input: Error | string | undefined): string;
declare namespace extractStack {
function lines(input: Error | string | undefined): string[];
}
+22
View File
@@ -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",
"extract-stack-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }