Skip to content

PurePath.parents property

pathlib-ts > PurePath > parents

Provides indexed access to the sequence of lexical (logical) ancestors of the path.

Signature:

get parents(): PathParents;

The returned object implements Iterable, enabling constructs like for (const parent of path.parents). This mirrors CPython behaviour and honours flavour-specific casing rules.