Comparing version 6.0.0 to 6.1.0
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13592
5
163
178
5