UNPKG

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