Skip to content

resolveWithinRoot

Resolves an output-relative path to an absolute path inside the build-output root, rejecting paths that escape it via .. segments.

Import:

import { resolveWithinRoot } from '@mnaoumov/typescript-dev-toolkit/docs-site/link-check';

Signature:

function resolveWithinRoot(outputRootPath: string, outputRelativePath: string): string | null

Parameters:

Parameter Type Description
outputRootPath string The absolute build-output root path.
outputRelativePath string The decoded output-relative path.

Returns: string | null — The joined path when it stays within the root, otherwise null.