| 1 | import * as t from "@babel/types"; |
| 2 | |
| 3 | export default function generateValidators() { |
| 4 | let output = `/* |
| 5 | * This file is auto-generated! Do not modify it directly. |
| 6 | * To re-generate run 'make build' |
| 7 | */ |
| 8 | import type * as t from "@babel/types"; |
| 9 | import type NodePath from "../index"; |
| 10 | import type { VirtualTypeNodePathValidators } from "../lib/virtual-types-validator"; |
| 11 | |
| 12 | interface BaseNodePathValidators { |
| 13 | `; |
| 14 | |
| 15 | for (const type of [...t.TYPES].sort()) { |
| 16 | output += `is${type}<T extends t.Node>(this: NodePath<T>, opts?: object): this is NodePath<T & t.${type}>;`; |
| 17 | } |
| 18 | |
| 19 | output += ` |
| 20 | } |
| 21 | |
| 22 | export interface NodePathValidators |
| 23 | extends BaseNodePathValidators, VirtualTypeNodePathValidators {} |
| 24 | `; |
| 25 | |
| 26 | return output; |
| 27 | } |