import { format, fromFileUrl, join, parse, posix, relative, resolve, sep, toFileUrl, win32, type ParsedPath, type Path, type PathObject, } from "avril:path"; import { delimiter as posixDelimiter, format as posixFormat, join as posixJoin, parse as posixParse, sep as posixSep, toFileUrl as posixToFileUrl, } from "avril:path/posix"; import { delimiter as win32Delimiter, join as win32Join, sep as win32Sep, } from "avril:path/win32"; const parsed: ParsedPath = parse("/a/b/c.txt"); const dir: string = parsed.dir; const formatted: string = format({ dir: "/a/b", base: "c.txt" }); const flavor: Path = posix; const joined: string = join("a", "b"); const resolved: string = resolve("/a", "b"); const related: string = relative("/a", "/a/b"); const obj: PathObject = { root: "/", base: "x" }; // The flavors pin their separators as literals. const posixSeparator: "/" = posixSep; const posixDelim: ":" = posixDelimiter; const win32Separator: "\\" = win32Sep; const win32Delim: ";" = win32Delimiter; // @ts-expect-error posix sep is a forward slash. const wrongPosixSep: "/" = win32Sep; // @ts-expect-error win32 sep is a backslash. const wrongWin32Sep: "\\" = posixSep; // @ts-expect-error posix delimiter is a colon. const wrongPosixDelim: ":" = win32Delimiter; // The native flavor varies by host, so its separators stay `string`: this // passes only for plain `string` and fails for `"/"` and `"\\"` alike. const arbitrary: typeof sep = "any string"; const nativePosix: Path = posix; const nativeWin32: Path = win32; const url = toFileUrl("/a/b"); const back: string = fromFileUrl(url); const posixUrl = posixToFileUrl("/a/b"); const posixJoined: string = posixJoin("a", "b"); const win32Joined: string = win32Join("a", "b"); const posixFormatted: string = posixFormat({ dir: "a", base: "b" }); const posixParsed: ParsedPath = posixParse("a/b"); void parsed; void formatted; void flavor; void joined; void resolved; void related; void obj; void posixSeparator; void posixDelim; void win32Separator; void win32Delim; void wrongPosixSep; void wrongWin32Sep; void wrongPosixDelim; void arbitrary; void nativePosix; void nativeWin32; void url; void back; void posixUrl; void posixJoined; void win32Joined; void posixFormatted; void posixParsed;