Skip to content

Commit

Permalink
Add TypeScript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 10, 2022
1 parent ca6dbe1 commit 1789651
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
13 changes: 13 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
Creates a `.stack` property on the given `object`, which when accessed returns a string representing the location in the code at which `captureStackTrace()` was called.
@example
```
import captureStackTrace from 'capture-stack-trace';
const object = {};
captureStackTrace(object);
object.stack; // Similar to `new Error().stack`
```
*/
export default function captureStackTrace(targetObject: object): void; // eslint-disable-line @typescript-eslint/ban-types
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@
"repository": "sindresorhus/capture-stack-trace",
"funding": "https://github.com/sponsors/sindresorhus",
"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": ">=14.16"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"keywords": [
"ponyfill",
"polyfill",
"shim",
"error",
"capturestacktrace",
"capture",
Expand Down

0 comments on commit 1789651

Please sign in to comment.