committed by
GitHub
parent
20d2b4f98d
commit
e4f3964f67
2
node_modules/@babel/traverse/scripts/generators/asserts.js
generated
vendored
2
node_modules/@babel/traverse/scripts/generators/asserts.js
generated
vendored
@ -1,4 +1,4 @@
|
||||
import t from "@babel/types";
|
||||
import * as t from "@babel/types";
|
||||
|
||||
export default function generateAsserts() {
|
||||
let output = `/*
|
||||
|
9
node_modules/@babel/traverse/scripts/generators/validators.js
generated
vendored
9
node_modules/@babel/traverse/scripts/generators/validators.js
generated
vendored
@ -1,5 +1,5 @@
|
||||
import t from "@babel/types";
|
||||
import virtualTypes from "../../lib/path/lib/virtual-types.js";
|
||||
import * as t from "@babel/types";
|
||||
import * as virtualTypes from "../../lib/path/lib/virtual-types.js";
|
||||
|
||||
export default function generateValidators() {
|
||||
let output = `/*
|
||||
@ -18,12 +18,17 @@ export interface NodePathValidators {
|
||||
}
|
||||
|
||||
for (const type of Object.keys(virtualTypes)) {
|
||||
// TODO: Remove this check once we stop compiling to CJS
|
||||
if (type === "default" || type === "__esModule") continue;
|
||||
|
||||
const { types } = virtualTypes[type];
|
||||
if (type[0] === "_") continue;
|
||||
if (t.NODE_FIELDS[type] || t.FLIPPED_ALIAS_KEYS[type]) {
|
||||
output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
|
||||
} else if (types /* in VirtualTypeAliases */) {
|
||||
output += `is${type}(opts?: object): this is NodePath<VirtualTypeAliases["${type}"]>;`;
|
||||
} else if (type === "Pure") {
|
||||
output += `isPure(constantsOnly?: boolean): boolean;`;
|
||||
} else {
|
||||
// if it don't have types, then VirtualTypeAliases[type] is t.Node
|
||||
// which TS marked as always true
|
||||
|
5
node_modules/@babel/traverse/scripts/generators/virtual-types.js
generated
vendored
5
node_modules/@babel/traverse/scripts/generators/virtual-types.js
generated
vendored
@ -1,4 +1,4 @@
|
||||
import virtualTypes from "../../lib/path/lib/virtual-types.js";
|
||||
import * as virtualTypes from "../../lib/path/lib/virtual-types.js";
|
||||
|
||||
export default function generateValidators() {
|
||||
let output = `/*
|
||||
@ -11,6 +11,9 @@ export interface VirtualTypeAliases {
|
||||
`;
|
||||
|
||||
for (const type of Object.keys(virtualTypes)) {
|
||||
// TODO: Remove this check once we stop compiling to CJS
|
||||
if (type === "default" || type === "__esModule") continue;
|
||||
|
||||
output += ` ${type}: ${(virtualTypes[type].types || ["Node"])
|
||||
.map(t => `t.${t}`)
|
||||
.join(" | ")};`;
|
||||
|
Reference in New Issue
Block a user