Skip to content

Commit

Permalink
chore(experimental-utils): remove useless union types ast-utils pre…
Browse files Browse the repository at this point in the history
…dicates (#3289)
  • Loading branch information
MichaelDeBoey committed May 15, 2021
1 parent e8c4b9b commit c80b5f2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/experimental-utils/src/ast-utils/predicates.ts
@@ -1,24 +1,20 @@
import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree';

function isOptionalChainPunctuator(
token: TSESTree.Token | TSESTree.Comment,
token: TSESTree.Token,
): token is TSESTree.PunctuatorToken & { value: '?.' } {
return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '?.';
}
function isNotOptionalChainPunctuator(
token: TSESTree.Token | TSESTree.Comment,
): boolean {
function isNotOptionalChainPunctuator(token: TSESTree.Token): boolean {
return !isOptionalChainPunctuator(token);
}

function isNonNullAssertionPunctuator(
token: TSESTree.Token | TSESTree.Comment,
token: TSESTree.Token,
): token is TSESTree.PunctuatorToken & { value: '!' } {
return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '!';
}
function isNotNonNullAssertionPunctuator(
token: TSESTree.Token | TSESTree.Comment,
): boolean {
function isNotNonNullAssertionPunctuator(token: TSESTree.Token): boolean {
return !isNonNullAssertionPunctuator(token);
}

Expand Down Expand Up @@ -209,7 +205,7 @@ function isAwaitExpression(
* Checks if a possible token is the `await` keyword.
*/
function isAwaitKeyword(
node: TSESTree.Token | TSESTree.Comment | undefined | null,
node: TSESTree.Token | undefined | null,
): node is TSESTree.KeywordToken & { value: 'await' } {
return node?.type === AST_TOKEN_TYPES.Identifier && node.value === 'await';
}
Expand Down

0 comments on commit c80b5f2

Please sign in to comment.