diff --git a/path/index.ts b/path/index.ts index 7b62b0b00d..4201c52ad1 100644 --- a/path/index.ts +++ b/path/index.ts @@ -119,7 +119,7 @@ function _format(sep: string, pathObject: FormatInputPathObject) { return dir + sep + base; } -const win32 = { +export const win32 = { // path.resolve([from ...], to) resolve: function resolve(...pathSegments: string[]) { let resolvedDevice = ""; @@ -1004,7 +1004,7 @@ const win32 = { posix: null }; -const posix = { +export const posix = { // path.resolve([from ...], to) resolve: function resolve(...pathSegments: string[]) { let resolvedPath = ""; @@ -1422,4 +1422,17 @@ posix.win32 = win32.win32 = win32; posix.posix = win32.posix = posix; const module = platform.os === "win" ? win32 : posix; -export = module; + +export const resolve = module.resolve; +export const normalize = module.normalize; +export const isAbsolute = module.isAbsolute; +export const join = module.join; +export const relative = module.relative; +export const toNamespacedPath = module.toNamespacedPath; +export const dirname = module.dirname; +export const basename = module.basename; +export const extname = module.extname; +export const format = module.format; +export const parse = module.parse; +export const sep = module.sep; +export const delimiter = module.delimiter; diff --git a/path/parse_format_test.ts b/path/parse_format_test.ts index 1b5e5908ad..be98f8739d 100644 --- a/path/parse_format_test.ts +++ b/path/parse_format_test.ts @@ -161,7 +161,7 @@ function checkFormat(path, testCases) { test(function parseTrailingWin32() { windowsTrailingTests.forEach(function(p) { - const actual = path.win32.parse(p[0]); + const actual = path.win32.parse(p[0] as string); const expected = p[1]; assertEqual(actual, expected); }); @@ -169,7 +169,7 @@ test(function parseTrailingWin32() { test(function parseTrailing() { posixTrailingTests.forEach(function(p) { - const actual = path.posix.parse(p[0]); + const actual = path.posix.parse(p[0] as string); const expected = p[1]; assertEqual(actual, expected); });