diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts
index adf236955b..153b285ae1 100644
--- a/types/fs-extra/index.d.ts
+++ b/types/fs-extra/index.d.ts
@@ -10,7 +10,8 @@
///
-import { Stats } from "fs";
+import * as fs from "fs";
+import Stats = fs.Stats;
export * from "fs";
@@ -206,8 +207,9 @@ export function rmdir(path: string | Buffer): Promise;
export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function stat(path: string | Buffer): Promise;
-export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err: NodeJS.ErrnoException) => void): void;
-export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): Promise;
+export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: fs.symlink.Type | undefined, callback: (err: NodeJS.ErrnoException) => void): void;
+export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
+export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: fs.symlink.Type): Promise;
export function truncate(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function truncate(path: string | Buffer, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
diff --git a/types/node/index.d.ts b/types/node/index.d.ts
index d964a41c43..14e4bf4a64 100644
--- a/types/node/index.d.ts
+++ b/types/node/index.d.ts
@@ -3461,7 +3461,7 @@ declare module "fs" {
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
- export function symlink(target: PathLike, path: PathLike, type: string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void;
+ export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void;
/**
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
@@ -3480,6 +3480,8 @@ declare module "fs" {
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
export function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise;
+
+ export type Type = "dir" | "file" | "junction";
}
/**
@@ -3489,7 +3491,7 @@ declare module "fs" {
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
- export function symlinkSync(target: PathLike, path: PathLike, type?: string | null): void;
+ export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts
index 27014e0cb0..8a27035ecc 100644
--- a/types/node/v8/index.d.ts
+++ b/types/node/v8/index.d.ts
@@ -3368,7 +3368,7 @@ declare module "fs" {
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
- export function symlink(target: PathLike, path: PathLike, type: string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void;
+ export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void;
/**
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
@@ -3387,6 +3387,8 @@ declare module "fs" {
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
export function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise;
+
+ export type Type = "dir" | "file" | "junction";
}
/**
@@ -3396,7 +3398,7 @@ declare module "fs" {
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
- export function symlinkSync(target: PathLike, path: PathLike, type?: string | null): void;
+ export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts
index 014fd9bac1..3fffc0a576 100644
--- a/types/node/v9/index.d.ts
+++ b/types/node/v9/index.d.ts
@@ -3450,7 +3450,7 @@ declare module "fs" {
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
- export function symlink(target: PathLike, path: PathLike, type: string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void;
+ export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void;
/**
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
@@ -3469,6 +3469,8 @@ declare module "fs" {
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
export function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise;
+
+ export type Type = "dir" | "file" | "junction";
}
/**
@@ -3478,7 +3480,7 @@ declare module "fs" {
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
- export function symlinkSync(target: PathLike, path: PathLike, type?: string | null): void;
+ export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.