Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript instructions don't work? #2693

Closed
ianstormtaylor opened this issue Feb 20, 2021 · 2 comments
Closed

TypeScript instructions don't work? #2693

ianstormtaylor opened this issue Feb 20, 2021 · 2 comments

Comments

@ianstormtaylor
Copy link

Based on the TypeScript instructions getting AVA working with TypeScript at runtime should be just installing ts-node and typescript and then adding configuration:

"extensions": [
  "ts",
  "tsx"
],
"require": [
  "ts-node/register"
]

But this results in errors for the import syntax:

Uncaught exception in test/ava/test.ts

/Users/Storm/dev/ianstormtaylor/nucleus/test/ava/test.ts:1
import test from 'ava';
^^^^^^

SyntaxError: Cannot use import statement outside a module

Might there need to be more done as part of the configuration that isn't documented?

@fregante
Copy link

fregante commented Feb 20, 2021

Refer to #2593

@novemberborn
Copy link
Member

@ianstormtaylor #2593 provides the solution, somebody just needs to turn it into a PR.

Alternatively if you want to avoid ts-node, avajs/typescript#5 is about updating our TypeScript provider to support ESM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants