getTreeElement()function
getTreeElement(map: ReadonlyMap<string, TreeElement>, ref: string): TreeElement | undefined
| Param | Type | |
|---|---|---|
map | ReadonlyMap<string, TreeElement> | The flattened tree lookup map (from useTreeMap()). required |
ref | string | The reference string — a flat key, canonical path, or token written in its display form. required |
| Return | |
|---|---|
TreeElement | undefined | The resolved element, or undefined on a miss. |
Resolve a reference string to its tree element — by exact key first, then by a normalised key with the prose display decorations stripped.
- Exact lookup handles flat keys (
"BooleanSchema","Store.get") and canonical paths ("/schema/BooleanSchema"). - On a miss, the reference is normalised so a token written in its prose display form still resolves: generics (
"Schema<T>"→"Schema"), call parens ("formatDate()"/"Store.get()"→ bare name), component angle brackets ("<Section>"→"Section"), and the module package prefix ("shelving/schema"→ the"/schema"canonical path). This is what lets a bare backtick reference in markup auto-link. - A qualified
"Owner.member"whose member has no page of its own falls back to the owner's (class/interface) page — so"StringSchema.validate()"still links even whenvalidateisn't a standalone token. - A compound reference (
"Schema<T> | null","Omit<X, 'k'>") only retries on the leading identifier when the whole string isIdentifier<…>; otherwise it stays a miss and the caller falls back to plain text.
Examples
getTreeElement(useTreeMap(), "formatDate()") // the `formatDate` element