Skip to content

Dynamic Imports are not handled #129

@bennycode

Description

@bennycode

I tested the following code in the TypeScript AST Viewer:

const module = await import('./my-function.function'); 

It shows that this call expression is of type SyntaxKind.ImportKeyword, which isn't currently handled in convertFile.

This snippet could help detect it:

const initializer = declaration.getInitializerIfKind(SyntaxKind.AwaitExpression);
const callExpression = initializer?.getExpressionIfKind(SyntaxKind.CallExpression);
const importExpression = callExpression?.getExpressionIfKind(SyntaxKind.ImportKeyword);

Expected output:

const module = await import('./my-function.function.js'); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions