/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/babel-traverse/src/context.ts
25 строк
733 B
liuxingbaoyu
fix: Improve type reasoning for visitors containing `|` (#17899)
16 апр 2026, 21:25
Не верифицирован
16 апр 2026, 21:25
39b57b4
Код
Авторство
О чём код?
import type { ExplodedVisitor, TraverseOptions } from "./types.ts"; import type NodePath from "./path/index.ts"; import type * as t from "@babel/types"; export default class TraversalContext<S = unknown> { constructor(opts: TraverseOptions & ExplodedVisitor<S>, state: S) { this.state = state; this.opts = opts; } declare state: S; declare opts: TraverseOptions & ExplodedVisitor<S>; queue: NodePath<t.Node | null>[] | null = null; priorityQueue: NodePath<t.Node | null>[] | null = null; maybeQueue(path: NodePath<t.Node | null>, notPriority?: boolean) { if (this.queue) { if (notPriority) { this.queue.push(path); } else { this.priorityQueue!.push(path); } } } }