UNPKG

3.78 kBTypeScriptView Raw
1import { TSESTree } from '../ts-estree';
2declare function isOptionalChainPunctuator(token: TSESTree.Token): token is TSESTree.PunctuatorToken & {
3 value: '?.';
4};
5declare function isNotOptionalChainPunctuator(token: TSESTree.Token): boolean;
6declare function isNonNullAssertionPunctuator(token: TSESTree.Token): token is TSESTree.PunctuatorToken & {
7 value: '!';
8};
9declare function isNotNonNullAssertionPunctuator(token: TSESTree.Token): boolean;
10/**
11 * Returns true if and only if the node represents: foo?.() or foo.bar?.()
12 */
13declare function isOptionalCallExpression(node: TSESTree.Node): node is TSESTree.CallExpression & {
14 optional: true;
15};
16/**
17 * Returns true if and only if the node represents logical OR
18 */
19declare function isLogicalOrOperator(node: TSESTree.Node): node is TSESTree.LogicalExpression & {
20 operator: '||';
21};
22/**
23 * Checks if a node is a type assertion:
24 * ```
25 * x as foo
26 * <foo>x
27 * ```
28 */
29declare function isTypeAssertion(node: TSESTree.Node | undefined | null): node is TSESTree.TSAsExpression | TSESTree.TSTypeAssertion;
30declare function isVariableDeclarator(node: TSESTree.Node | undefined): node is TSESTree.VariableDeclarator;
31declare function isFunction(node: TSESTree.Node | undefined): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression;
32declare function isFunctionType(node: TSESTree.Node | undefined): node is TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructorType | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.TSFunctionType | TSESTree.TSMethodSignature;
33declare function isFunctionOrFunctionType(node: TSESTree.Node | undefined): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructorType | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.TSFunctionType | TSESTree.TSMethodSignature;
34declare function isTSFunctionType(node: TSESTree.Node | undefined): node is TSESTree.TSFunctionType;
35declare function isTSConstructorType(node: TSESTree.Node | undefined): node is TSESTree.TSConstructorType;
36declare function isClassOrTypeElement(node: TSESTree.Node | undefined): node is TSESTree.ClassElement | TSESTree.TypeElement;
37/**
38 * Checks if a node is a constructor method.
39 */
40declare function isConstructor(node: TSESTree.Node | undefined): node is TSESTree.MethodDefinition;
41/**
42 * Checks if a node is a setter method.
43 */
44declare function isSetter(node: TSESTree.Node | undefined): node is TSESTree.MethodDefinition | TSESTree.Property;
45declare function isIdentifier(node: TSESTree.Node | undefined): node is TSESTree.Identifier;
46/**
47 * Checks if a node represents an `await …` expression.
48 */
49declare function isAwaitExpression(node: TSESTree.Node | undefined | null): node is TSESTree.AwaitExpression;
50/**
51 * Checks if a possible token is the `await` keyword.
52 */
53declare function isAwaitKeyword(node: TSESTree.Token | undefined | null): node is TSESTree.IdentifierToken & {
54 value: 'await';
55};
56declare function isLoop(node: TSESTree.Node | undefined | null): node is TSESTree.DoWhileStatement | TSESTree.ForStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.WhileStatement;
57export { isAwaitExpression, isAwaitKeyword, isConstructor, isClassOrTypeElement, isFunction, isFunctionOrFunctionType, isFunctionType, isIdentifier, isLoop, isLogicalOrOperator, isNonNullAssertionPunctuator, isNotNonNullAssertionPunctuator, isNotOptionalChainPunctuator, isOptionalChainPunctuator, isOptionalCallExpression, isSetter, isTSConstructorType, isTSFunctionType, isTypeAssertion, isVariableDeclarator, };
58//# sourceMappingURL=predicates.d.ts.map
\No newline at end of file