Skip to content

Commit

Permalink
fix(experimental-utils): fix eslint-utils' negative predicates' ret…
Browse files Browse the repository at this point in the history
…urn types
  • Loading branch information
MichaelDeBoey committed Jun 4, 2021
1 parent fc5f171 commit 6a9962a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/experimental-utils/src/ast-utils/predicates.ts
Expand Up @@ -5,7 +5,12 @@ function isOptionalChainPunctuator(
): token is TSESTree.PunctuatorToken & { value: '?.' } {
return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '?.';
}
function isNotOptionalChainPunctuator(token: TSESTree.Token): boolean {
function isNotOptionalChainPunctuator(
token: TSESTree.Token,
): token is Exclude<
TSESTree.Token,
TSESTree.PunctuatorToken & { value: '?.' }
> {
return !isOptionalChainPunctuator(token);
}

Expand All @@ -14,7 +19,9 @@ function isNonNullAssertionPunctuator(
): token is TSESTree.PunctuatorToken & { value: '!' } {
return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '!';
}
function isNotNonNullAssertionPunctuator(token: TSESTree.Token): boolean {
function isNotNonNullAssertionPunctuator(
token: TSESTree.Token,
): token is Exclude<TSESTree.Token, TSESTree.PunctuatorToken & { value: '!' }> {
return !isNonNullAssertionPunctuator(token);
}

Expand Down

0 comments on commit 6a9962a

Please sign in to comment.