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