Closed aubreyyan closed 4 years ago
I'm not sure I follow… are you upgrading an existing installation? Remembering something you did before?
AVA 3 supports CJS modules, and for most use cases on supporting Node.js versions ESM. We've removed any automatic transpilation.
@ava/typescript
, at its current stage, makes it easier to run TypeScript tests, provided you have already compiled them. Assuming you're working on a Node.js program and not something that gets packaged further using, say, webpack, you shouldn't have to make any adjustments. If Node.js can run your program, AVA can run your tests.
Hope that helps. I don't think our documentation needs to explain why something it said previously is no longer valid.
(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)
What I'm saying actually, is that the bit about needing to set module
to commonjs
is actually still a required step for typescript to find ava's type definitions. With latest versions of everything, since it was a project I started recently. @novemberborn
What I'm saying actually, is that the bit about needing to set
module
tocommonjs
is actually still a required step for typescript to find ava's type definitions.
Huh. Not sure why that would be. @sindresorhus?
@novemberborn
I'm sure this has happened a thousand times but I can't reproduce it. I distinctly recall typescript complaining about my ava import until I switched the module from es2020 to commonjs, but I have since commented out module entirely and when creating a new ava project typescript works without any tsconfig. So we should be good here
I don't think that's correct. Any module type should be able to find any kind of type definition. How you import such type definition matter though.
@sindresorhus I think I commented too late! It's not reproducible so there probably isn't any problem.
While digging through some issue/commit history regarding typescript, I ran into this
https://github.com/avajs/ava/blob/0e1886582833986b896c31859aa61d8da404e996/readme.md#typescript-support
from this commit https://github.com/avajs/ava/commit/0e1886582833986b896c31859aa61d8da404e996
which essentially reads
It has since been removed from the main readme and possibly replaced with a link to recipes/typescript.md (that's what it looks like, at least), which doesn't say anything regarding the
tsconfig
setup and instead points to avajs/typescript readme for setup, which says nothing abouttsconfig
.So now, I'm stuck in the predicament of not knowing whether I need to make certain adjustments to my
tsconfig
, and switch to commonjs + es2015, as opposed to es2020.Given this discrepancy, I think it's worth it to at least give a nod to the fact that in the past modifications needed to be made to
tsconfig
and what the state of typescript setup looks like now.Also
This might be another issue, but is there a reason commonjs needs to be the
tsconfig
module setting as opposed to es2020? Have we just not upgraded?