Skip to content

Dynamic Imports are not handled #129

Closed

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'); 

Activity

  1. changed the title [-]Dynamic Imports Are Not Converted[/-] [+]Dynamic Imports are not handled[/+] on Feb 8, 2025
  2. linked a pull request that will close this issuefeat: Convert dynamic imports #130on Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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