Skip to content

Instantly share code, notes, and snippets.

@joshblack
Last active January 1, 2021 23:44
Show Gist options
  • Save joshblack/5f2bf75038e23fdf80ac to your computer and use it in GitHub Desktop.
Save joshblack/5f2bf75038e23fdf80ac to your computer and use it in GitHub Desktop.
Documentation of all the Babel type methods

Babel Types

Hopefully will be documentation of unclear methods available for Babel Types

  • is
  • isType
  • shallowEqual
  • appendToMemberExpression
  • prependToMemberExpression
  • ensureBlock
  • clone
  • cloneDeep
  • buildMatchMemberExpression
  • removeComments
  • inheritsComments
  • inheritTrailingComments
  • inheritLeadingComments
  • inheritInnerComments
  • inherits
  • STATEMENT_OR_BLOCK_KEYS
  • FLATTENABLE_KEYS
  • FOR_INIT_KEYS
  • COMMENT_KEYS
  • INHERIT_KEYS
  • BOOLEAN_NUMBER_BINARY_OPERATORS
  • EQUALITY_BINARY_OPERATORS
  • COMPARISON_BINARY_OPERATORS
  • BOOLEAN_BINARY_OPERATORS
  • NUMBER_BINARY_OPERATORS
  • BOOLEAN_UNARY_OPERATORS
  • NUMBER_UNARY_OPERATORS
  • STRING_UNARY_OPERATORS
  • VISITOR_KEYS
  • BUILDER_KEYS
  • ALIAS_KEYS
  • isArrayExpression
  • assertArrayExpression
  • isAssignmentExpression
  • assertAssignmentExpression
  • isBinaryExpression
  • assertBinaryExpression
  • isBlockStatement
  • assertBlockStatement
  • isBreakStatement
  • assertBreakStatement
  • isCallExpression
  • assertCallExpression
  • isCatchClause
  • assertCatchClause
  • isConditionalExpression
  • assertConditionalExpression
  • isContinueStatement
  • assertContinueStatement
  • isDebuggerStatement
  • assertDebuggerStatement
  • isDoWhileStatement
  • assertDoWhileStatement
  • isEmptyStatement
  • assertEmptyStatement
  • isExpressionStatement
  • assertExpressionStatement
  • isFile
  • assertFile
  • isForInStatement
  • assertForInStatement
  • isForStatement
  • assertForStatement
  • isFunctionDeclaration
  • assertFunctionDeclaration
  • isFunctionExpression
  • assertFunctionExpression
  • isIdentifier
  • assertIdentifier
  • isIfStatement
  • assertIfStatement
  • isLabeledStatement
  • assertLabeledStatement
  • isLiteral
  • assertLiteral
  • isLogicalExpression
  • assertLogicalExpression
  • isMemberExpression
  • assertMemberExpression
  • isNewExpression
  • assertNewExpression
  • isObjectExpression
  • assertObjectExpression
  • isProgram
  • assertProgram
  • isProperty
  • assertProperty
  • isRestElement
  • assertRestElement
  • isReturnStatement
  • assertReturnStatement
  • isSequenceExpression
  • assertSequenceExpression
  • isSwitchCase
  • assertSwitchCase
  • isSwitchStatement
  • assertSwitchStatement
  • isThisExpression
  • assertThisExpression
  • isThrowStatement
  • assertThrowStatement
  • isTryStatement
  • assertTryStatement
  • isUnaryExpression
  • assertUnaryExpression
  • isUpdateExpression
  • assertUpdateExpression
  • isVariableDeclaration
  • assertVariableDeclaration
  • isVariableDeclarator
  • assertVariableDeclarator
  • isWhileStatement
  • assertWhileStatement
  • isWithStatement
  • assertWithStatement
  • isAssignmentPattern
  • assertAssignmentPattern
  • isArrayPattern
  • assertArrayPattern
  • isArrowFunctionExpression
  • assertArrowFunctionExpression
  • isClassBody
  • assertClassBody
  • isClassDeclaration
  • assertClassDeclaration
  • isClassExpression
  • assertClassExpression
  • isExportAllDeclaration
  • assertExportAllDeclaration
  • isExportDefaultDeclaration
  • assertExportDefaultDeclaration
  • isExportNamedDeclaration
  • assertExportNamedDeclaration
  • isExportDefaultSpecifier
  • assertExportDefaultSpecifier
  • isExportNamespaceSpecifier
  • assertExportNamespaceSpecifier
  • isExportSpecifier
  • assertExportSpecifier
  • isForOfStatement
  • assertForOfStatement
  • isImportDeclaration
  • assertImportDeclaration
  • isImportDefaultSpecifier
  • assertImportDefaultSpecifier
  • isImportNamespaceSpecifier
  • assertImportNamespaceSpecifier
  • isImportSpecifier
  • assertImportSpecifier
  • isMetaProperty
  • assertMetaProperty
  • isMethodDefinition
  • assertMethodDefinition
  • isObjectPattern
  • assertObjectPattern
  • isSpreadElement
  • assertSpreadElement
  • isSuper
  • assertSuper
  • isTaggedTemplateExpression
  • assertTaggedTemplateExpression
  • isTemplateElement
  • assertTemplateElement
  • isTemplateLiteral
  • assertTemplateLiteral
  • isYieldExpression
  • assertYieldExpression
  • isAnyTypeAnnotation
  • assertAnyTypeAnnotation
  • isArrayTypeAnnotation
  • assertArrayTypeAnnotation
  • isBooleanTypeAnnotation
  • assertBooleanTypeAnnotation
  • isBooleanLiteralTypeAnnotation
  • assertBooleanLiteralTypeAnnotation
  • isClassImplements
  • assertClassImplements
  • isClassProperty
  • assertClassProperty
  • isDeclareClass
  • assertDeclareClass
  • isDeclareFunction
  • assertDeclareFunction
  • isDeclareModule
  • assertDeclareModule
  • isDeclareVariable
  • assertDeclareVariable
  • isFunctionTypeAnnotation
  • assertFunctionTypeAnnotation
  • isFunctionTypeParam
  • assertFunctionTypeParam
  • isGenericTypeAnnotation
  • assertGenericTypeAnnotation
  • isInterfaceExtends
  • assertInterfaceExtends
  • isInterfaceDeclaration
  • assertInterfaceDeclaration
  • isIntersectionTypeAnnotation
  • assertIntersectionTypeAnnotation
  • isMixedTypeAnnotation
  • assertMixedTypeAnnotation
  • isNullableTypeAnnotation
  • assertNullableTypeAnnotation
  • isNumberLiteralTypeAnnotation
  • assertNumberLiteralTypeAnnotation
  • isNumberTypeAnnotation
  • assertNumberTypeAnnotation
  • isStringLiteralTypeAnnotation
  • assertStringLiteralTypeAnnotation
  • isStringTypeAnnotation
  • assertStringTypeAnnotation
  • isTupleTypeAnnotation
  • assertTupleTypeAnnotation
  • isTypeofTypeAnnotation
  • assertTypeofTypeAnnotation
  • isTypeAlias
  • assertTypeAlias
  • isTypeAnnotation
  • assertTypeAnnotation
  • isTypeCastExpression
  • assertTypeCastExpression
  • isTypeParameterDeclaration
  • assertTypeParameterDeclaration
  • isTypeParameterInstantiation
  • assertTypeParameterInstantiation
  • isObjectTypeAnnotation
  • assertObjectTypeAnnotation
  • isObjectTypeCallProperty
  • assertObjectTypeCallProperty
  • isObjectTypeIndexer
  • assertObjectTypeIndexer
  • isObjectTypeProperty
  • assertObjectTypeProperty
  • isQualifiedTypeIdentifier
  • assertQualifiedTypeIdentifier
  • isUnionTypeAnnotation
  • assertUnionTypeAnnotation
  • isVoidTypeAnnotation
  • assertVoidTypeAnnotation
  • isJSXAttribute
  • assertJSXAttribute
  • isJSXClosingElement
  • assertJSXClosingElement
  • isJSXElement
  • assertJSXElement
  • isJSXEmptyExpression
  • assertJSXEmptyExpression
  • isJSXExpressionContainer
  • assertJSXExpressionContainer
  • isJSXIdentifier
  • assertJSXIdentifier
  • isJSXMemberExpression
  • assertJSXMemberExpression
  • isJSXNamespacedName
  • assertJSXNamespacedName
  • isJSXOpeningElement
  • assertJSXOpeningElement
  • isJSXSpreadAttribute
  • assertJSXSpreadAttribute
  • isNoop
  • assertNoop
  • isParenthesizedExpression
  • assertParenthesizedExpression
  • isAwaitExpression
  • assertAwaitExpression
  • isBindExpression
  • assertBindExpression
  • isComprehensionBlock
  • assertComprehensionBlock
  • isComprehensionExpression
  • assertComprehensionExpression
  • isDecorator
  • assertDecorator
  • isDoExpression
  • assertDoExpression
  • isSpreadProperty
  • assertSpreadProperty
  • FLIPPED_ALIAS_KEYS
  • EXPRESSION_TYPES
  • isExpression
  • assertExpression
  • BINARY_TYPES
  • isBinary
  • assertBinary
  • SCOPABLE_TYPES
  • isScopable
  • assertScopable
  • BLOCKPARENT_TYPES
  • isBlockParent
  • assertBlockParent
  • BLOCK_TYPES
  • isBlock
  • assertBlock
  • STATEMENT_TYPES
  • isStatement
  • assertStatement
  • TERMINATORLESS_TYPES
  • isTerminatorless
  • assertTerminatorless
  • COMPLETIONSTATEMENT_TYPES
  • isCompletionStatement
  • assertCompletionStatement
  • LOOP_TYPES
  • isLoop
  • assertLoop
  • WHILE_TYPES
  • isWhile
  • assertWhile
  • FOR_TYPES
  • isFor
  • assertFor
  • FORXSTATEMENT_TYPES
  • isForXStatement
  • assertForXStatement
  • FUNCTION_TYPES
  • isFunction
  • assertFunction
  • FUNC_TYPES
  • isFunc
  • assertFunc
  • FUNCTIONPARENT_TYPES
  • isFunctionParent
  • assertFunctionParent
  • PURE_TYPES
  • isPure
  • assertPure
  • DECLARATION_TYPES
  • isDeclaration
  • assertDeclaration
  • USERWHITESPACABLE_TYPES
  • isUserWhitespacable
  • assertUserWhitespacable
  • UNARYLIKE_TYPES
  • isUnaryLike
  • assertUnaryLike
  • PATTERN_TYPES
  • isPattern
  • assertPattern
  • CLASS_TYPES
  • isClass
  • assertClass
  • MODULEDECLARATION_TYPES
  • isModuleDeclaration
  • assertModuleDeclaration
  • EXPORTDECLARATION_TYPES
  • isExportDeclaration
  • assertExportDeclaration
  • MODULESPECIFIER_TYPES
  • isModuleSpecifier
  • assertModuleSpecifier
  • FLOW_TYPES
  • isFlow
  • assertFlow
  • FLOWBASEANNOTATION_TYPES
  • isFlowBaseAnnotation
  • assertFlowBaseAnnotation
  • FLOWDECLARATION_TYPES
  • isFlowDeclaration
  • assertFlowDeclaration
  • JSX_TYPES
  • isJSX
  • assertJSX
  • IMMUTABLE_TYPES
  • isImmutable
  • assertImmutable
  • TYPES
  • ArrayExpression
  • arrayExpression
  • AssignmentExpression
  • assignmentExpression
  • BinaryExpression
  • binaryExpression
  • BlockStatement
  • blockStatement
  • BreakStatement
  • breakStatement
  • CallExpression
  • callExpression
  • CatchClause
  • catchClause
  • ConditionalExpression
  • conditionalExpression
  • ContinueStatement
  • continueStatement
  • DebuggerStatement
  • debuggerStatement
  • DoWhileStatement
  • doWhileStatement
  • EmptyStatement
  • emptyStatement
  • ExpressionStatement
  • expressionStatement
  • File
  • file
  • ForInStatement
  • forInStatement
  • ForStatement
  • forStatement
  • FunctionDeclaration
  • functionDeclaration
  • FunctionExpression
  • functionExpression
  • Identifier
  • identifier
  • IfStatement
  • ifStatement
  • LabeledStatement
  • labeledStatement
  • Literal
  • literal
  • LogicalExpression
  • logicalExpression
  • MemberExpression
  • memberExpression
  • NewExpression
  • newExpression
  • ObjectExpression
  • objectExpression
  • Program
  • program
  • Property
  • property
  • RestElement
  • restElement
  • ReturnStatement
  • returnStatement
  • SequenceExpression
  • sequenceExpression
  • SwitchCase
  • switchCase
  • SwitchStatement
  • switchStatement
  • ThisExpression
  • thisExpression
  • ThrowStatement
  • throwStatement
  • TryStatement
  • tryStatement
  • UnaryExpression
  • unaryExpression
  • UpdateExpression
  • updateExpression
  • VariableDeclaration
  • variableDeclaration
  • VariableDeclarator
  • variableDeclarator
  • WhileStatement
  • whileStatement
  • WithStatement
  • withStatement
  • AssignmentPattern
  • assignmentPattern
  • ArrayPattern
  • arrayPattern
  • ArrowFunctionExpression
  • arrowFunctionExpression
  • ClassBody
  • classBody
  • ClassDeclaration
  • classDeclaration
  • ClassExpression
  • classExpression
  • ExportAllDeclaration
  • exportAllDeclaration
  • ExportDefaultDeclaration
  • exportDefaultDeclaration
  • ExportNamedDeclaration
  • exportNamedDeclaration
  • ExportDefaultSpecifier
  • exportDefaultSpecifier
  • ExportNamespaceSpecifier
  • exportNamespaceSpecifier
  • ExportSpecifier
  • exportSpecifier
  • ForOfStatement
  • forOfStatement
  • ImportDeclaration
  • importDeclaration
  • ImportDefaultSpecifier
  • importDefaultSpecifier
  • ImportNamespaceSpecifier
  • importNamespaceSpecifier
  • ImportSpecifier
  • importSpecifier
  • MetaProperty
  • metaProperty
  • MethodDefinition
  • methodDefinition
  • ObjectPattern
  • objectPattern
  • SpreadElement
  • spreadElement
  • Super
  • super
  • TaggedTemplateExpression
  • taggedTemplateExpression
  • TemplateElement
  • templateElement
  • TemplateLiteral
  • templateLiteral
  • YieldExpression
  • yieldExpression
  • AnyTypeAnnotation
  • anyTypeAnnotation
  • ArrayTypeAnnotation
  • arrayTypeAnnotation
  • BooleanTypeAnnotation
  • booleanTypeAnnotation
  • BooleanLiteralTypeAnnotation
  • booleanLiteralTypeAnnotation
  • ClassImplements
  • classImplements
  • ClassProperty
  • classProperty
  • DeclareClass
  • declareClass
  • DeclareFunction
  • declareFunction
  • DeclareModule
  • declareModule
  • DeclareVariable
  • declareVariable
  • FunctionTypeAnnotation
  • functionTypeAnnotation
  • FunctionTypeParam
  • functionTypeParam
  • GenericTypeAnnotation
  • genericTypeAnnotation
  • InterfaceExtends
  • interfaceExtends
  • InterfaceDeclaration
  • interfaceDeclaration
  • IntersectionTypeAnnotation
  • intersectionTypeAnnotation
  • MixedTypeAnnotation
  • mixedTypeAnnotation
  • NullableTypeAnnotation
  • nullableTypeAnnotation
  • NumberLiteralTypeAnnotation
  • numberLiteralTypeAnnotation
  • NumberTypeAnnotation
  • numberTypeAnnotation
  • StringLiteralTypeAnnotation
  • stringLiteralTypeAnnotation
  • StringTypeAnnotation
  • stringTypeAnnotation
  • TupleTypeAnnotation
  • tupleTypeAnnotation
  • TypeofTypeAnnotation
  • typeofTypeAnnotation
  • TypeAlias
  • typeAlias
  • TypeAnnotation
  • typeAnnotation
  • TypeCastExpression
  • typeCastExpression
  • TypeParameterDeclaration
  • typeParameterDeclaration
  • TypeParameterInstantiation
  • typeParameterInstantiation
  • ObjectTypeAnnotation
  • objectTypeAnnotation
  • ObjectTypeCallProperty
  • objectTypeCallProperty
  • ObjectTypeIndexer
  • objectTypeIndexer
  • ObjectTypeProperty
  • objectTypeProperty
  • QualifiedTypeIdentifier
  • qualifiedTypeIdentifier
  • UnionTypeAnnotation
  • unionTypeAnnotation
  • VoidTypeAnnotation
  • voidTypeAnnotation
  • JSXAttribute
  • jSXAttribute
  • JSXClosingElement
  • jSXClosingElement
  • JSXElement
  • jSXElement
  • JSXEmptyExpression
  • jSXEmptyExpression
  • JSXExpressionContainer
  • jSXExpressionContainer
  • JSXIdentifier
  • jSXIdentifier
  • JSXMemberExpression
  • jSXMemberExpression
  • JSXNamespacedName
  • jSXNamespacedName
  • JSXOpeningElement
  • jSXOpeningElement
  • JSXSpreadAttribute
  • jSXSpreadAttribute
  • Noop
  • noop
  • ParenthesizedExpression
  • parenthesizedExpression
  • AwaitExpression
  • awaitExpression
  • BindExpression
  • bindExpression
  • ComprehensionBlock
  • comprehensionBlock
  • ComprehensionExpression
  • comprehensionExpression
  • Decorator
  • decorator
  • DoExpression
  • doExpression
  • SpreadProperty
  • spreadProperty
  • getBindingIdentifiers
  • isBinding
  • isReferenced
  • isValidIdentifier
  • isLet
  • isBlockScoped
  • isVar
  • isSpecifierDefault
  • isScope
  • toComputedKey
  • toSequenceExpression
  • toKeyAlias
  • toIdentifier
  • toBindingIdentifierName
  • toStatement
  • toExpression
  • toBlock
  • valueToNode
  • createUnionTypeAnnotation
  • removeTypeDuplicates
  • createTypeAnnotationBasedOnTypeof
@qimingweng
Copy link

@joshblack did you find any documentation for some of these types?

@apuravchauhan
Copy link

@ibeizhu
Copy link

ibeizhu commented Jan 10, 2019

is there api comment for every api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment