node: Fix missing CustomPromisify for fs.link. (#39675)

* node: Fix missing CustomPromisify for fs.link.

* node: Fix missing CustomPromisify for fs.link.

Backporting fix to node v8 - v11.
This commit is contained in:
Daniel Cassidy
2019-10-30 15:42:29 +00:00
committed by Jesse Trinity
parent f74064b512
commit 5fad4d66bc
6 changed files with 9 additions and 5 deletions

2
types/node/fs.d.ts vendored
View File

@@ -490,7 +490,7 @@ declare module "fs" {
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**

View File

@@ -119,6 +119,10 @@ async function testPromisify() {
const listDir: fs.Dirent[] = await rd('path', { withFileTypes: true });
const listDir2: Buffer[] = await rd('path', { withFileTypes: false, encoding: 'buffer' });
const listDir3: fs.Dirent[] = await rd('path', { encoding: 'utf8', withFileTypes: true });
const ln = util.promisify(fs.link);
// $ExpectType Promise<void>
ln("abc", "def");
}
{

View File

@@ -442,7 +442,7 @@ declare module "fs" {
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**

View File

@@ -442,7 +442,7 @@ declare module "fs" {
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**

View File

@@ -3473,7 +3473,7 @@ declare module "fs" {
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
export function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**

View File

@@ -3877,7 +3877,7 @@ declare module "fs" {
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
export function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**