Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pify

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pify - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

index.d.ts

13

package.json
{
"name": "pify",
"version": "6.0.0",
"version": "6.1.0",
"description": "Promisify a callback-style function",

@@ -15,2 +15,3 @@ "license": "MIT",

"exports": "./index.js",
"types": "./index.d.ts",
"engines": {

@@ -20,7 +21,8 @@ "node": ">=14.16"

"scripts": {
"test": "xo && ava",
"test": "xo && ava && tsd",
"optimization-test": "node --allow-natives-syntax optimization-test.js"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],

@@ -48,7 +50,8 @@ "keywords": [

"devDependencies": {
"ava": "^4.3.0",
"ava": "^4.3.3",
"pinkie-promise": "^2.0.1",
"tsd": "^0.23.0",
"v8-natives": "^1.2.5",
"xo": "^0.49.0"
"xo": "^0.52.3"
}
}

@@ -145,2 +145,18 @@ # pify

#### Why is `pify` choosing the last function overload when using it with TypeScript?
If you're using TypeScript and your input has [function overloads](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads), then only the last overload will be chosen and promisified.
If you need to choose a different overload, consider using a type assertion:
```ts
function overloadedFunction(input: number, callback: (error: unknown, data: number => void): void
function overloadedFunction(input: string, callback: (error: unknown, data: string) => void): void {
/* … */
}
const fn = pify(overloadedFunction as (input: number, callback: (error: unknown, data: number) => void) => void)
// ^ ? (input: number) => Promise<number>
```
## Related

@@ -147,0 +163,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc