diff --git a/lib/types.js b/lib/types.js index 8926e27e2f..92be02f84d 100644 --- a/lib/types.js +++ b/lib/types.js @@ -1486,247 +1486,247 @@ declare module "babel-types" { declare function tSTypeParameterInstantiation(params: any): BabelNodeTSTypeParameterInstantiation; declare function tSTypeParameterDeclaration(params: any): BabelNodeTSTypeParameterDeclaration; declare function tSTypeParameter(constraint?: ?BabelNodeTSType, _default?: ?BabelNodeTSType, name?: string): BabelNodeTSTypeParameter; - declare function isArrayExpression(node: Object, opts?: Object): boolean; - declare function isAssignmentExpression(node: Object, opts?: Object): boolean; - declare function isBinaryExpression(node: Object, opts?: Object): boolean; - declare function isDirective(node: Object, opts?: Object): boolean; - declare function isDirectiveLiteral(node: Object, opts?: Object): boolean; - declare function isBlockStatement(node: Object, opts?: Object): boolean; - declare function isBreakStatement(node: Object, opts?: Object): boolean; - declare function isCallExpression(node: Object, opts?: Object): boolean; - declare function isCatchClause(node: Object, opts?: Object): boolean; - declare function isConditionalExpression(node: Object, opts?: Object): boolean; - declare function isContinueStatement(node: Object, opts?: Object): boolean; - declare function isDebuggerStatement(node: Object, opts?: Object): boolean; - declare function isDoWhileStatement(node: Object, opts?: Object): boolean; - declare function isEmptyStatement(node: Object, opts?: Object): boolean; - declare function isExpressionStatement(node: Object, opts?: Object): boolean; - declare function isFile(node: Object, opts?: Object): boolean; - declare function isForInStatement(node: Object, opts?: Object): boolean; - declare function isForStatement(node: Object, opts?: Object): boolean; - declare function isFunctionDeclaration(node: Object, opts?: Object): boolean; - declare function isFunctionExpression(node: Object, opts?: Object): boolean; - declare function isIdentifier(node: Object, opts?: Object): boolean; - declare function isIfStatement(node: Object, opts?: Object): boolean; - declare function isLabeledStatement(node: Object, opts?: Object): boolean; - declare function isStringLiteral(node: Object, opts?: Object): boolean; - declare function isNumericLiteral(node: Object, opts?: Object): boolean; - declare function isNullLiteral(node: Object, opts?: Object): boolean; - declare function isBooleanLiteral(node: Object, opts?: Object): boolean; - declare function isRegExpLiteral(node: Object, opts?: Object): boolean; - declare function isLogicalExpression(node: Object, opts?: Object): boolean; - declare function isMemberExpression(node: Object, opts?: Object): boolean; - declare function isNewExpression(node: Object, opts?: Object): boolean; - declare function isProgram(node: Object, opts?: Object): boolean; - declare function isObjectExpression(node: Object, opts?: Object): boolean; - declare function isObjectMethod(node: Object, opts?: Object): boolean; - declare function isObjectProperty(node: Object, opts?: Object): boolean; - declare function isRestElement(node: Object, opts?: Object): boolean; - declare function isReturnStatement(node: Object, opts?: Object): boolean; - declare function isSequenceExpression(node: Object, opts?: Object): boolean; - declare function isSwitchCase(node: Object, opts?: Object): boolean; - declare function isSwitchStatement(node: Object, opts?: Object): boolean; - declare function isThisExpression(node: Object, opts?: Object): boolean; - declare function isThrowStatement(node: Object, opts?: Object): boolean; - declare function isTryStatement(node: Object, opts?: Object): boolean; - declare function isUnaryExpression(node: Object, opts?: Object): boolean; - declare function isUpdateExpression(node: Object, opts?: Object): boolean; - declare function isVariableDeclaration(node: Object, opts?: Object): boolean; - declare function isVariableDeclarator(node: Object, opts?: Object): boolean; - declare function isWhileStatement(node: Object, opts?: Object): boolean; - declare function isWithStatement(node: Object, opts?: Object): boolean; - declare function isAssignmentPattern(node: Object, opts?: Object): boolean; - declare function isArrayPattern(node: Object, opts?: Object): boolean; - declare function isArrowFunctionExpression(node: Object, opts?: Object): boolean; - declare function isClassBody(node: Object, opts?: Object): boolean; - declare function isClassDeclaration(node: Object, opts?: Object): boolean; - declare function isClassExpression(node: Object, opts?: Object): boolean; - declare function isExportAllDeclaration(node: Object, opts?: Object): boolean; - declare function isExportDefaultDeclaration(node: Object, opts?: Object): boolean; - declare function isExportNamedDeclaration(node: Object, opts?: Object): boolean; - declare function isExportSpecifier(node: Object, opts?: Object): boolean; - declare function isForOfStatement(node: Object, opts?: Object): boolean; - declare function isImportDeclaration(node: Object, opts?: Object): boolean; - declare function isImportDefaultSpecifier(node: Object, opts?: Object): boolean; - declare function isImportNamespaceSpecifier(node: Object, opts?: Object): boolean; - declare function isImportSpecifier(node: Object, opts?: Object): boolean; - declare function isMetaProperty(node: Object, opts?: Object): boolean; - declare function isClassMethod(node: Object, opts?: Object): boolean; - declare function isObjectPattern(node: Object, opts?: Object): boolean; - declare function isSpreadElement(node: Object, opts?: Object): boolean; - declare function isSuper(node: Object, opts?: Object): boolean; - declare function isTaggedTemplateExpression(node: Object, opts?: Object): boolean; - declare function isTemplateElement(node: Object, opts?: Object): boolean; - declare function isTemplateLiteral(node: Object, opts?: Object): boolean; - declare function isYieldExpression(node: Object, opts?: Object): boolean; - declare function isAnyTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isArrayTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isBooleanTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isBooleanLiteralTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isNullLiteralTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isClassImplements(node: Object, opts?: Object): boolean; - declare function isDeclareClass(node: Object, opts?: Object): boolean; - declare function isDeclareFunction(node: Object, opts?: Object): boolean; - declare function isDeclareInterface(node: Object, opts?: Object): boolean; - declare function isDeclareModule(node: Object, opts?: Object): boolean; - declare function isDeclareModuleExports(node: Object, opts?: Object): boolean; - declare function isDeclareTypeAlias(node: Object, opts?: Object): boolean; - declare function isDeclareOpaqueType(node: Object, opts?: Object): boolean; - declare function isDeclareVariable(node: Object, opts?: Object): boolean; - declare function isDeclareExportDeclaration(node: Object, opts?: Object): boolean; - declare function isDeclareExportAllDeclaration(node: Object, opts?: Object): boolean; - declare function isDeclaredPredicate(node: Object, opts?: Object): boolean; - declare function isExistsTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isFunctionTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isFunctionTypeParam(node: Object, opts?: Object): boolean; - declare function isGenericTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isInferredPredicate(node: Object, opts?: Object): boolean; - declare function isInterfaceExtends(node: Object, opts?: Object): boolean; - declare function isInterfaceDeclaration(node: Object, opts?: Object): boolean; - declare function isIntersectionTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isMixedTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isEmptyTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isNullableTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isNumberLiteralTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isNumberTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isObjectTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isObjectTypeCallProperty(node: Object, opts?: Object): boolean; - declare function isObjectTypeIndexer(node: Object, opts?: Object): boolean; - declare function isObjectTypeProperty(node: Object, opts?: Object): boolean; - declare function isObjectTypeSpreadProperty(node: Object, opts?: Object): boolean; - declare function isOpaqueType(node: Object, opts?: Object): boolean; - declare function isQualifiedTypeIdentifier(node: Object, opts?: Object): boolean; - declare function isStringLiteralTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isStringTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isThisTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isTupleTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isTypeofTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isTypeAlias(node: Object, opts?: Object): boolean; - declare function isTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isTypeCastExpression(node: Object, opts?: Object): boolean; - declare function isTypeParameter(node: Object, opts?: Object): boolean; - declare function isTypeParameterDeclaration(node: Object, opts?: Object): boolean; - declare function isTypeParameterInstantiation(node: Object, opts?: Object): boolean; - declare function isUnionTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isVoidTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isJSXAttribute(node: Object, opts?: Object): boolean; - declare function isJSXClosingElement(node: Object, opts?: Object): boolean; - declare function isJSXElement(node: Object, opts?: Object): boolean; - declare function isJSXEmptyExpression(node: Object, opts?: Object): boolean; - declare function isJSXExpressionContainer(node: Object, opts?: Object): boolean; - declare function isJSXSpreadChild(node: Object, opts?: Object): boolean; - declare function isJSXIdentifier(node: Object, opts?: Object): boolean; - declare function isJSXMemberExpression(node: Object, opts?: Object): boolean; - declare function isJSXNamespacedName(node: Object, opts?: Object): boolean; - declare function isJSXOpeningElement(node: Object, opts?: Object): boolean; - declare function isJSXSpreadAttribute(node: Object, opts?: Object): boolean; - declare function isJSXText(node: Object, opts?: Object): boolean; - declare function isNoop(node: Object, opts?: Object): boolean; - declare function isParenthesizedExpression(node: Object, opts?: Object): boolean; - declare function isAwaitExpression(node: Object, opts?: Object): boolean; - declare function isBindExpression(node: Object, opts?: Object): boolean; - declare function isClassProperty(node: Object, opts?: Object): boolean; - declare function isImport(node: Object, opts?: Object): boolean; - declare function isDecorator(node: Object, opts?: Object): boolean; - declare function isDoExpression(node: Object, opts?: Object): boolean; - declare function isExportDefaultSpecifier(node: Object, opts?: Object): boolean; - declare function isExportNamespaceSpecifier(node: Object, opts?: Object): boolean; - declare function isTSParameterProperty(node: Object, opts?: Object): boolean; - declare function isTSDeclareFunction(node: Object, opts?: Object): boolean; - declare function isTSDeclareMethod(node: Object, opts?: Object): boolean; - declare function isTSQualifiedName(node: Object, opts?: Object): boolean; - declare function isTSCallSignatureDeclaration(node: Object, opts?: Object): boolean; - declare function isTSConstructSignatureDeclaration(node: Object, opts?: Object): boolean; - declare function isTSPropertySignature(node: Object, opts?: Object): boolean; - declare function isTSMethodSignature(node: Object, opts?: Object): boolean; - declare function isTSIndexSignature(node: Object, opts?: Object): boolean; - declare function isTSAnyKeyword(node: Object, opts?: Object): boolean; - declare function isTSNumberKeyword(node: Object, opts?: Object): boolean; - declare function isTSObjectKeyword(node: Object, opts?: Object): boolean; - declare function isTSBooleanKeyword(node: Object, opts?: Object): boolean; - declare function isTSStringKeyword(node: Object, opts?: Object): boolean; - declare function isTSSymbolKeyword(node: Object, opts?: Object): boolean; - declare function isTSVoidKeyword(node: Object, opts?: Object): boolean; - declare function isTSUndefinedKeyword(node: Object, opts?: Object): boolean; - declare function isTSNullKeyword(node: Object, opts?: Object): boolean; - declare function isTSNeverKeyword(node: Object, opts?: Object): boolean; - declare function isTSThisType(node: Object, opts?: Object): boolean; - declare function isTSFunctionType(node: Object, opts?: Object): boolean; - declare function isTSConstructorType(node: Object, opts?: Object): boolean; - declare function isTSTypeReference(node: Object, opts?: Object): boolean; - declare function isTSTypePredicate(node: Object, opts?: Object): boolean; - declare function isTSTypeQuery(node: Object, opts?: Object): boolean; - declare function isTSTypeLiteral(node: Object, opts?: Object): boolean; - declare function isTSArrayType(node: Object, opts?: Object): boolean; - declare function isTSTupleType(node: Object, opts?: Object): boolean; - declare function isTSUnionType(node: Object, opts?: Object): boolean; - declare function isTSIntersectionType(node: Object, opts?: Object): boolean; - declare function isTSParenthesizedType(node: Object, opts?: Object): boolean; - declare function isTSTypeOperator(node: Object, opts?: Object): boolean; - declare function isTSIndexedAccessType(node: Object, opts?: Object): boolean; - declare function isTSMappedType(node: Object, opts?: Object): boolean; - declare function isTSLiteralType(node: Object, opts?: Object): boolean; - declare function isTSExpressionWithTypeArguments(node: Object, opts?: Object): boolean; - declare function isTSInterfaceDeclaration(node: Object, opts?: Object): boolean; - declare function isTSInterfaceBody(node: Object, opts?: Object): boolean; - declare function isTSTypeAliasDeclaration(node: Object, opts?: Object): boolean; - declare function isTSAsExpression(node: Object, opts?: Object): boolean; - declare function isTSTypeAssertion(node: Object, opts?: Object): boolean; - declare function isTSEnumDeclaration(node: Object, opts?: Object): boolean; - declare function isTSEnumMember(node: Object, opts?: Object): boolean; - declare function isTSModuleDeclaration(node: Object, opts?: Object): boolean; - declare function isTSModuleBlock(node: Object, opts?: Object): boolean; - declare function isTSImportEqualsDeclaration(node: Object, opts?: Object): boolean; - declare function isTSExternalModuleReference(node: Object, opts?: Object): boolean; - declare function isTSNonNullExpression(node: Object, opts?: Object): boolean; - declare function isTSExportAssignment(node: Object, opts?: Object): boolean; - declare function isTSNamespaceExportDeclaration(node: Object, opts?: Object): boolean; - declare function isTSTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isTSTypeParameterInstantiation(node: Object, opts?: Object): boolean; - declare function isTSTypeParameterDeclaration(node: Object, opts?: Object): boolean; - declare function isTSTypeParameter(node: Object, opts?: Object): boolean; - declare function isExpression(node: Object, opts?: Object): boolean; - declare function isBinary(node: Object, opts?: Object): boolean; - declare function isScopable(node: Object, opts?: Object): boolean; - declare function isBlockParent(node: Object, opts?: Object): boolean; - declare function isBlock(node: Object, opts?: Object): boolean; - declare function isStatement(node: Object, opts?: Object): boolean; - declare function isTerminatorless(node: Object, opts?: Object): boolean; - declare function isCompletionStatement(node: Object, opts?: Object): boolean; - declare function isConditional(node: Object, opts?: Object): boolean; - declare function isLoop(node: Object, opts?: Object): boolean; - declare function isWhile(node: Object, opts?: Object): boolean; - declare function isExpressionWrapper(node: Object, opts?: Object): boolean; - declare function isFor(node: Object, opts?: Object): boolean; - declare function isForXStatement(node: Object, opts?: Object): boolean; - declare function isFunction(node: Object, opts?: Object): boolean; - declare function isFunctionParent(node: Object, opts?: Object): boolean; - declare function isPureish(node: Object, opts?: Object): boolean; - declare function isDeclaration(node: Object, opts?: Object): boolean; - declare function isPatternLike(node: Object, opts?: Object): boolean; - declare function isLVal(node: Object, opts?: Object): boolean; - declare function isTSEntityName(node: Object, opts?: Object): boolean; - declare function isLiteral(node: Object, opts?: Object): boolean; - declare function isImmutable(node: Object, opts?: Object): boolean; - declare function isUserWhitespacable(node: Object, opts?: Object): boolean; - declare function isMethod(node: Object, opts?: Object): boolean; - declare function isObjectMember(node: Object, opts?: Object): boolean; - declare function isProperty(node: Object, opts?: Object): boolean; - declare function isUnaryLike(node: Object, opts?: Object): boolean; - declare function isPattern(node: Object, opts?: Object): boolean; - declare function isClass(node: Object, opts?: Object): boolean; - declare function isModuleDeclaration(node: Object, opts?: Object): boolean; - declare function isExportDeclaration(node: Object, opts?: Object): boolean; - declare function isModuleSpecifier(node: Object, opts?: Object): boolean; - declare function isFlow(node: Object, opts?: Object): boolean; - declare function isFlowBaseAnnotation(node: Object, opts?: Object): boolean; - declare function isFlowDeclaration(node: Object, opts?: Object): boolean; - declare function isFlowPredicate(node: Object, opts?: Object): boolean; - declare function isJSX(node: Object, opts?: Object): boolean; - declare function isTSTypeElement(node: Object, opts?: Object): boolean; - declare function isTSType(node: Object, opts?: Object): boolean; - declare function isNumberLiteral(node: Object, opts?: Object): boolean; - declare function isRegexLiteral(node: Object, opts?: Object): boolean; + declare function isArrayExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayExpression) + declare function isAssignmentExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentExpression) + declare function isBinaryExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBinaryExpression) + declare function isDirective(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirective) + declare function isDirectiveLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirectiveLiteral) + declare function isBlockStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBlockStatement) + declare function isBreakStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBreakStatement) + declare function isCallExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCallExpression) + declare function isCatchClause(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCatchClause) + declare function isConditionalExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeConditionalExpression) + declare function isContinueStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeContinueStatement) + declare function isDebuggerStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDebuggerStatement) + declare function isDoWhileStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoWhileStatement) + declare function isEmptyStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyStatement) + declare function isExpressionStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExpressionStatement) + declare function isFile(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFile) + declare function isForInStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForInStatement) + declare function isForStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForStatement) + declare function isFunctionDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionDeclaration) + declare function isFunctionExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionExpression) + declare function isIdentifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIdentifier) + declare function isIfStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIfStatement) + declare function isLabeledStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLabeledStatement) + declare function isStringLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteral) + declare function isNumericLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumericLiteral) + declare function isNullLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteral) + declare function isBooleanLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteral) + declare function isRegExpLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRegExpLiteral) + declare function isLogicalExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLogicalExpression) + declare function isMemberExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMemberExpression) + declare function isNewExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNewExpression) + declare function isProgram(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeProgram) + declare function isObjectExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectExpression) + declare function isObjectMethod(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectMethod) + declare function isObjectProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectProperty) + declare function isRestElement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRestElement) + declare function isReturnStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeReturnStatement) + declare function isSequenceExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSequenceExpression) + declare function isSwitchCase(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchCase) + declare function isSwitchStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchStatement) + declare function isThisExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisExpression) + declare function isThrowStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThrowStatement) + declare function isTryStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTryStatement) + declare function isUnaryExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnaryExpression) + declare function isUpdateExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUpdateExpression) + declare function isVariableDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclaration) + declare function isVariableDeclarator(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclarator) + declare function isWhileStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWhileStatement) + declare function isWithStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWithStatement) + declare function isAssignmentPattern(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentPattern) + declare function isArrayPattern(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayPattern) + declare function isArrowFunctionExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrowFunctionExpression) + declare function isClassBody(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassBody) + declare function isClassDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassDeclaration) + declare function isClassExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassExpression) + declare function isExportAllDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportAllDeclaration) + declare function isExportDefaultDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultDeclaration) + declare function isExportNamedDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamedDeclaration) + declare function isExportSpecifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportSpecifier) + declare function isForOfStatement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForOfStatement) + declare function isImportDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDeclaration) + declare function isImportDefaultSpecifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDefaultSpecifier) + declare function isImportNamespaceSpecifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportNamespaceSpecifier) + declare function isImportSpecifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportSpecifier) + declare function isMetaProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMetaProperty) + declare function isClassMethod(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassMethod) + declare function isObjectPattern(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectPattern) + declare function isSpreadElement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSpreadElement) + declare function isSuper(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSuper) + declare function isTaggedTemplateExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTaggedTemplateExpression) + declare function isTemplateElement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateElement) + declare function isTemplateLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateLiteral) + declare function isYieldExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeYieldExpression) + declare function isAnyTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAnyTypeAnnotation) + declare function isArrayTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayTypeAnnotation) + declare function isBooleanTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanTypeAnnotation) + declare function isBooleanLiteralTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteralTypeAnnotation) + declare function isNullLiteralTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteralTypeAnnotation) + declare function isClassImplements(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassImplements) + declare function isDeclareClass(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareClass) + declare function isDeclareFunction(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareFunction) + declare function isDeclareInterface(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareInterface) + declare function isDeclareModule(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModule) + declare function isDeclareModuleExports(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModuleExports) + declare function isDeclareTypeAlias(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareTypeAlias) + declare function isDeclareOpaqueType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareOpaqueType) + declare function isDeclareVariable(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareVariable) + declare function isDeclareExportDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportDeclaration) + declare function isDeclareExportAllDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportAllDeclaration) + declare function isDeclaredPredicate(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclaredPredicate) + declare function isExistsTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExistsTypeAnnotation) + declare function isFunctionTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeAnnotation) + declare function isFunctionTypeParam(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeParam) + declare function isGenericTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeGenericTypeAnnotation) + declare function isInferredPredicate(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInferredPredicate) + declare function isInterfaceExtends(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceExtends) + declare function isInterfaceDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceDeclaration) + declare function isIntersectionTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIntersectionTypeAnnotation) + declare function isMixedTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMixedTypeAnnotation) + declare function isEmptyTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyTypeAnnotation) + declare function isNullableTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullableTypeAnnotation) + declare function isNumberLiteralTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberLiteralTypeAnnotation) + declare function isNumberTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberTypeAnnotation) + declare function isObjectTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeAnnotation) + declare function isObjectTypeCallProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeCallProperty) + declare function isObjectTypeIndexer(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeIndexer) + declare function isObjectTypeProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeProperty) + declare function isObjectTypeSpreadProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeSpreadProperty) + declare function isOpaqueType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOpaqueType) + declare function isQualifiedTypeIdentifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeQualifiedTypeIdentifier) + declare function isStringLiteralTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteralTypeAnnotation) + declare function isStringTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringTypeAnnotation) + declare function isThisTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisTypeAnnotation) + declare function isTupleTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTupleTypeAnnotation) + declare function isTypeofTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeofTypeAnnotation) + declare function isTypeAlias(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAlias) + declare function isTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAnnotation) + declare function isTypeCastExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeCastExpression) + declare function isTypeParameter(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameter) + declare function isTypeParameterDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterDeclaration) + declare function isTypeParameterInstantiation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterInstantiation) + declare function isUnionTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnionTypeAnnotation) + declare function isVoidTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVoidTypeAnnotation) + declare function isJSXAttribute(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXAttribute) + declare function isJSXClosingElement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingElement) + declare function isJSXElement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXElement) + declare function isJSXEmptyExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXEmptyExpression) + declare function isJSXExpressionContainer(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXExpressionContainer) + declare function isJSXSpreadChild(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadChild) + declare function isJSXIdentifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXIdentifier) + declare function isJSXMemberExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXMemberExpression) + declare function isJSXNamespacedName(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXNamespacedName) + declare function isJSXOpeningElement(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningElement) + declare function isJSXSpreadAttribute(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadAttribute) + declare function isJSXText(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXText) + declare function isNoop(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNoop) + declare function isParenthesizedExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeParenthesizedExpression) + declare function isAwaitExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAwaitExpression) + declare function isBindExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBindExpression) + declare function isClassProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassProperty) + declare function isImport(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImport) + declare function isDecorator(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDecorator) + declare function isDoExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoExpression) + declare function isExportDefaultSpecifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultSpecifier) + declare function isExportNamespaceSpecifier(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamespaceSpecifier) + declare function isTSParameterProperty(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParameterProperty) + declare function isTSDeclareFunction(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareFunction) + declare function isTSDeclareMethod(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareMethod) + declare function isTSQualifiedName(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSQualifiedName) + declare function isTSCallSignatureDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSCallSignatureDeclaration) + declare function isTSConstructSignatureDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructSignatureDeclaration) + declare function isTSPropertySignature(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSPropertySignature) + declare function isTSMethodSignature(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMethodSignature) + declare function isTSIndexSignature(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexSignature) + declare function isTSAnyKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAnyKeyword) + declare function isTSNumberKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNumberKeyword) + declare function isTSObjectKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSObjectKeyword) + declare function isTSBooleanKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSBooleanKeyword) + declare function isTSStringKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSStringKeyword) + declare function isTSSymbolKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSSymbolKeyword) + declare function isTSVoidKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSVoidKeyword) + declare function isTSUndefinedKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUndefinedKeyword) + declare function isTSNullKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNullKeyword) + declare function isTSNeverKeyword(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNeverKeyword) + declare function isTSThisType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSThisType) + declare function isTSFunctionType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSFunctionType) + declare function isTSConstructorType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructorType) + declare function isTSTypeReference(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeReference) + declare function isTSTypePredicate(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypePredicate) + declare function isTSTypeQuery(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeQuery) + declare function isTSTypeLiteral(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeLiteral) + declare function isTSArrayType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSArrayType) + declare function isTSTupleType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTupleType) + declare function isTSUnionType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnionType) + declare function isTSIntersectionType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIntersectionType) + declare function isTSParenthesizedType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParenthesizedType) + declare function isTSTypeOperator(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeOperator) + declare function isTSIndexedAccessType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexedAccessType) + declare function isTSMappedType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMappedType) + declare function isTSLiteralType(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSLiteralType) + declare function isTSExpressionWithTypeArguments(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExpressionWithTypeArguments) + declare function isTSInterfaceDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceDeclaration) + declare function isTSInterfaceBody(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceBody) + declare function isTSTypeAliasDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAliasDeclaration) + declare function isTSAsExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAsExpression) + declare function isTSTypeAssertion(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAssertion) + declare function isTSEnumDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumDeclaration) + declare function isTSEnumMember(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumMember) + declare function isTSModuleDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleDeclaration) + declare function isTSModuleBlock(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleBlock) + declare function isTSImportEqualsDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportEqualsDeclaration) + declare function isTSExternalModuleReference(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExternalModuleReference) + declare function isTSNonNullExpression(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNonNullExpression) + declare function isTSExportAssignment(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExportAssignment) + declare function isTSNamespaceExportDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNamespaceExportDeclaration) + declare function isTSTypeAnnotation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAnnotation) + declare function isTSTypeParameterInstantiation(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterInstantiation) + declare function isTSTypeParameterDeclaration(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterDeclaration) + declare function isTSTypeParameter(node: Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameter) + declare function isExpression(node: Object, opts?: ?Object): boolean + declare function isBinary(node: Object, opts?: ?Object): boolean + declare function isScopable(node: Object, opts?: ?Object): boolean + declare function isBlockParent(node: Object, opts?: ?Object): boolean + declare function isBlock(node: Object, opts?: ?Object): boolean + declare function isStatement(node: Object, opts?: ?Object): boolean + declare function isTerminatorless(node: Object, opts?: ?Object): boolean + declare function isCompletionStatement(node: Object, opts?: ?Object): boolean + declare function isConditional(node: Object, opts?: ?Object): boolean + declare function isLoop(node: Object, opts?: ?Object): boolean + declare function isWhile(node: Object, opts?: ?Object): boolean + declare function isExpressionWrapper(node: Object, opts?: ?Object): boolean + declare function isFor(node: Object, opts?: ?Object): boolean + declare function isForXStatement(node: Object, opts?: ?Object): boolean + declare function isFunction(node: Object, opts?: ?Object): boolean + declare function isFunctionParent(node: Object, opts?: ?Object): boolean + declare function isPureish(node: Object, opts?: ?Object): boolean + declare function isDeclaration(node: Object, opts?: ?Object): boolean + declare function isPatternLike(node: Object, opts?: ?Object): boolean + declare function isLVal(node: Object, opts?: ?Object): boolean + declare function isTSEntityName(node: Object, opts?: ?Object): boolean + declare function isLiteral(node: Object, opts?: ?Object): boolean + declare function isImmutable(node: Object, opts?: ?Object): boolean + declare function isUserWhitespacable(node: Object, opts?: ?Object): boolean + declare function isMethod(node: Object, opts?: ?Object): boolean + declare function isObjectMember(node: Object, opts?: ?Object): boolean + declare function isProperty(node: Object, opts?: ?Object): boolean + declare function isUnaryLike(node: Object, opts?: ?Object): boolean + declare function isPattern(node: Object, opts?: ?Object): boolean + declare function isClass(node: Object, opts?: ?Object): boolean + declare function isModuleDeclaration(node: Object, opts?: ?Object): boolean + declare function isExportDeclaration(node: Object, opts?: ?Object): boolean + declare function isModuleSpecifier(node: Object, opts?: ?Object): boolean + declare function isFlow(node: Object, opts?: ?Object): boolean + declare function isFlowBaseAnnotation(node: Object, opts?: ?Object): boolean + declare function isFlowDeclaration(node: Object, opts?: ?Object): boolean + declare function isFlowPredicate(node: Object, opts?: ?Object): boolean + declare function isJSX(node: Object, opts?: ?Object): boolean + declare function isTSTypeElement(node: Object, opts?: ?Object): boolean + declare function isTSType(node: Object, opts?: ?Object): boolean + declare function isNumberLiteral(node: Object, opts?: ?Object): boolean + declare function isRegexLiteral(node: Object, opts?: ?Object): boolean declare function clone(n: T): T; declare function cloneDeep(n: T): T; declare function removeProperties(n: T, opts: ?{}): void; diff --git a/scripts/generate-interfaces.js b/scripts/generate-interfaces.js index 3777bd114d..b8595f70f7 100644 --- a/scripts/generate-interfaces.js +++ b/scripts/generate-interfaces.js @@ -124,9 +124,15 @@ for (const type in t.NODE_FIELDS) { } for (let i = 0; i < t.TYPES.length; i++) { - lines.push( - `declare function is${t.TYPES[i]}(node: Object, opts?: Object): boolean;` - ); + let decl = `declare function is${t.TYPES[ + i + ]}(node: Object, opts?: ?Object): boolean`; + + if (t.NODE_FIELDS[t.TYPES[i]]) { + decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`; + } + + lines.push(decl); } lines.push(