Skip to content

PurePath.isRelativeTo() method

pathlib-ts > PurePath > isRelativeTo

Returns true when the path can be expressed relative to another path without leaving its subtree.

Signature:

isRelativeTo(other: PathLike): boolean;

Parameter

Type

Description

other

PathLike

Anchor used to determine lexical containment.

Returns:

boolean

true when other is a lexical ancestor or the same path.

This is a lexical check that does not hit the filesystem. It aligns with CPython’s is_relative_to and powers Path.isRelativeTo before the async policy layer.