@babel/types
Advanced tools
Comparing version 7.21.4 to 7.21.5
@@ -6,14 +6,17 @@ "use strict"; | ||
const defineInterfaceishType = name => { | ||
const isDeclareClass = name === "DeclareClass"; | ||
defineType(name, { | ||
builder: ["id", "typeParameters", "extends", "body"], | ||
visitor: ["id", "typeParameters", "extends", "mixins", "implements", "body"], | ||
visitor: ["id", "typeParameters", "extends", ...(isDeclareClass ? ["mixins", "implements"] : []), "body"], | ||
aliases: ["FlowDeclaration", "Statement", "Declaration"], | ||
fields: { | ||
fields: Object.assign({ | ||
id: (0, _utils.validateType)("Identifier"), | ||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), | ||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), | ||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")) | ||
}, isDeclareClass ? { | ||
mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), | ||
implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")), | ||
implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")) | ||
} : {}, { | ||
body: (0, _utils.validateType)("ObjectTypeAnnotation") | ||
} | ||
}) | ||
}); | ||
@@ -20,0 +23,0 @@ }; |
@@ -11,3 +11,4 @@ "use strict"; | ||
} | ||
function removeTypeDuplicates(nodes) { | ||
function removeTypeDuplicates(nodesIn) { | ||
const nodes = Array.from(nodesIn); | ||
const generics = new Map(); | ||
@@ -32,3 +33,3 @@ const bases = new Map(); | ||
if (!typeGroups.has(node.types)) { | ||
nodes = nodes.concat(node.types); | ||
nodes.push(...node.types); | ||
typeGroups.add(node.types); | ||
@@ -44,3 +45,4 @@ } | ||
if (node.typeParameters) { | ||
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params)); | ||
existing.typeParameters.params.push(...node.typeParameters.params); | ||
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params); | ||
} | ||
@@ -47,0 +49,0 @@ } else { |
@@ -11,3 +11,4 @@ "use strict"; | ||
} | ||
function removeTypeDuplicates(nodes) { | ||
function removeTypeDuplicates(nodesIn) { | ||
const nodes = Array.from(nodesIn); | ||
const generics = new Map(); | ||
@@ -43,3 +44,4 @@ const bases = new Map(); | ||
if (node.typeParameters) { | ||
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params)); | ||
existing.typeParameters.params.push(...node.typeParameters.params); | ||
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params); | ||
} | ||
@@ -46,0 +48,0 @@ } else { |
{ | ||
"name": "@babel/types", | ||
"version": "7.21.4", | ||
"version": "7.21.5", | ||
"description": "Babel Types is a Lodash-esque utility library for AST nodes", | ||
@@ -27,3 +27,3 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"dependencies": { | ||
"@babel/helper-string-parser": "^7.19.4", | ||
"@babel/helper-string-parser": "^7.21.5", | ||
"@babel/helper-validator-identifier": "^7.19.1", | ||
@@ -33,4 +33,4 @@ "to-fast-properties": "^2.0.0" | ||
"devDependencies": { | ||
"@babel/generator": "^7.21.4", | ||
"@babel/parser": "^7.21.4", | ||
"@babel/generator": "^7.21.5", | ||
"@babel/parser": "^7.21.5", | ||
"chalk": "^4.1.0", | ||
@@ -37,0 +37,0 @@ "glob": "^7.2.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2385334
20268