Closed
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
const determineImportSource = (
node: TSESTree.AwaitExpression,
): string | null => {
if (node.argument.type === AST_NODE_TYPES.ImportExpression) {
//
}
return null;
};
Expected Result
No errors
Actual Result
An error from TypeScript:
This condition will always return 'false' since the types 'AST_NODE_TYPES.ArrayExpression | AST_NODE_TYPES.ArrayPattern | AST_NODE_TYPES.ArrowFunctionExpression | AST_NODE_TYPES.AwaitExpression | AST_NODE_TYPES.CallExpression | AST_NODE_TYPES.ClassExpression | ... 18 more ... | AST_NODE_TYPES.TSTypeAssertion' and 'AST_NODE_TYPES.ImportExpression' have no overlap
Additional Info
Here's an AST tree showing that it's possible to have an import expression as the argument of an await expression:
await import('@jest/globals');
Versions
package | version |
---|---|
@typescript-eslint/types |
5.20.0 |
TypeScript |
4.6.3 |
node |
v14.18.2 |