/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/babel-traverse/scripts/generators/asserts.ts
32 строки
716 B
liuxingbaoyu
chore: Use Gulpfile.mts (#17579)
26 ноя 2025, 00:58
Не верифицирован
26 ноя 2025, 00:58
aac2c37
Код
Авторство
О чём код?
import * as t from "@babel/types"; export default function generateAsserts() { let output = `/* * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ import type * as t from "@babel/types"; import type NodePath from "../index"; type Options<Obj> = Partial<{ [Prop in Exclude<keyof Obj, "type">]: Obj[Prop] extends t.Node ? t.Node : Obj[Prop] extends t.Node[] ? t.Node[] : Obj[Prop]; }>; export interface NodePathAssertions {`; for (const type of [...t.TYPES].sort()) { output += ` assert${type}<Opts extends Options<t.${type}>>( opts?: Opts, ): asserts this is NodePath<t.${type} & Opts>;`; } output += ` }`; return output; }