I've been trying to figure out how to import the node types (Node, Document, etc) and can't figure out any way to do it except via the DefaultTreeAdapter type and an index expression, which is quite non-obvious and tedious:
import {parse, type DefaultTreeAdapterMap} from 'parse5';
type Document = DefaultTreeAdapterMap['document'];
type Node = DefaultTreeAdapterMap['node'];
The API docs mention the DefaultTreeAdapterTypes namespace, but while that's in the source in index.ts:
export type * as DefaultTreeAdapterTypes from './tree-adapters/default.js';
That line doesn't appear in my installed dist/index.d.ts at least in version 7.1.2.
I can't import the type's exported from parse5/dist/tree-adapters/default.js because that file isn't in the package exports.
I've been trying to figure out how to import the node types (
Node,Document, etc) and can't figure out any way to do it except via theDefaultTreeAdaptertype and an index expression, which is quite non-obvious and tedious:The API docs mention the
DefaultTreeAdapterTypesnamespace, but while that's in the source inindex.ts:That line doesn't appear in my installed
dist/index.d.tsat least in version 7.1.2.I can't import the type's exported from
parse5/dist/tree-adapters/default.jsbecause that file isn't in the package exports.