/** * @typedef {Object} TsPaths * @property {string} baseDir baseUrl made repo-relative ("" for the root) * @property {{ prefix: string, suffix: string, wildcard: boolean, targets: string[] }[]} entries */ /** * Best-effort load of `/tsconfig.json`'s `baseUrl` + `paths`. Returns null when there is no * tsconfig or it can't be read/parsed — callers then resolve relative specifiers only (which is * correct: a repo without path aliases has none to resolve). * @param {string} root absolute repo root * @returns {TsPaths | null} */ export function loadTsPaths(root: string): TsPaths | null; /** * Does `import/export … from ""` written in `fromPath` resolve to the repo-relative file * `target`? Handles relative specifiers and (when `tsPaths` is given) tsconfig path aliases, trying * the usual extension + `/index.*` resolutions. Over-matching is acceptable (§7.2 over-count safe); * the point is never to MISS a real link to `target`. * @param {string} fromPath repo-relative file containing the specifier * @param {string} spec the raw module specifier * @param {string} target repo-relative file we're testing the specifier against * @param {TsPaths | null} tsPaths * @returns {boolean} */ export function specResolvesTo(fromPath: string, spec: string, target: string, tsPaths: TsPaths | null): boolean; export type TsPaths = { /** * baseUrl made repo-relative ("" for the root) */ baseDir: string; entries: { prefix: string; suffix: string; wildcard: boolean; targets: string[]; }[]; };