Skip to content

[BUG] Top Level Await #1885

@angelhdzmultimedia

Description

@angelhdzmultimedia

Search Terms

Expected Behavior

Being able to use top level await in a node typescript project.

Actual Behavior

Tons of errors no matter what combination of tsconfig.json, package.json and compiler flags I try.

Other solutions

I tried one setup using nodemon and babel and it worked, but with ts-node or ts-node-dev I can't get it working
and my search history is huge! Can't find a solution.
Even a solution I left someone else in the past, isn't currently working!!!
The solution was: nodemon -I --exec node --experimental-specifier-resolution=node --loader ts-node/esm ./src/main.ts

Please, help!!!

Steps to reproduce the problem

Minimal reproduction

Specifications

  • ts-node version: 10.9.1
  • node version: 18.1.0
  • TypeScript version: 4.8.3
  • tsconfig.json, if you're using one:
{}
  • package.json:
{}
  • Operating system and version: Windows 10.0.19044 Build 19044

  • If Windows, are you using WSL or WSL2?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions