You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ava test() expression is not callable / has no call signatures #3349
After updating Typescript from 5.5.4 to 5.6.3 i started to have an error
error TS2349: This expression is not callable.
Type 'typeof import("<full_path_to_project>/node_modules/ava/entrypoints/main")' has no call signatures.
Version of ava - 6.2.0
Version of Typescript - 5.6.3
Version of tsimp - 2.0.12
@KillyMXI Can you reproduce this outside of your project? With and without tsimp/import? Nothing would have changed in AVA so it suggests a problem elsewhere.
Just wanted to share a workaround for this issue. You can suppress TypeScript compilation errors in AVA/TSIMP by setting the TSIMP_DIAG environment variable in your AVA config:
The issue here is that entrypoints/main.d.cts declares export default test, but entrypoints/main.cjs uses module.exports = value — the correct TypeScript declaration for that CJS pattern is export = test. This mismatch is a FalseExportDefault (confirmed by @arethetypeswrong/cli). TypeScript 5.6 added stricter detection of it, which tsimp now surfaces as TS2349: This expression is not callable.
The fix is to change main.d.cts to use export = with the standard declare function + declare namespace merge pattern.
That being said, I don't think this is worth fixing. I think it's better to just remove CommonJS support for tests. It's time.
Activity
novemberborn commentedon Nov 15, 2024
Can you reproduce this outside of your project? With and without
tsimp/import? Nothing would have changed in AVA so it suggests a problem elsewhere.KillyMXI commentedon Dec 21, 2024
Same issue.
Same versions of ava, TypeScript, tsimp.
Tests are still passing, but there are also these error messages in the output.
The one as reported above and the other:
novemberborn commentedon Dec 23, 2024
@KillyMXI Can you reproduce this outside of your project? With and without tsimp/import? Nothing would have changed in AVA so it suggests a problem elsewhere.
KillyMXI commentedon Dec 24, 2024
All experiments done with Node.js v20.18.0
The issue reproduces if I bump
typescriptversion to 5.6.3 or 5.7.2.Trying to replace
tsimp:tsx- can't make it work anymore;ts-nodewith"--loader=ts-node/esm"- it gives a warning about--experimental-loader, but no type errors.Trying to roll back versions of
tsimp:avatimes out when usingtsimp2.0.11 andtypescript5.6.3 or 5.7.2 - only works with 5.5.4. No useful messages in case of timeout:Trying
tsimp2.0.12 andtypescript5.5.4 (cleannpm i) - no errors.tsimp2.0.11tsimp2.0.12typescript5.5.4typescript5.6.3, 5.7.2After facing the issue in one of my packages repo, I reproduced this in my playground repo with a single trivial test.
My repro branch: https://github.com/mxxii/yet-another-typescript-package-template/tree/tsimp-issue-repro
Test run log with the error messages: https://github.com/mxxii/yet-another-typescript-package-template/actions/runs/12484026510/job/34840790959#step:5:10
(Edit: logs are not public, but the error messages are also shown in the Annotations section.)
I've no idea how
avausestsimp, so I'm not sure if this is enough to bring to their repo.novemberborn commentedon Jan 6, 2025
@KillyMXI
AVA doesn't, you are through your config. Raising an issue with them makes sense, I can help point out how AVA loads files etc if needed.
cunneen commentedon Feb 7, 2025
This seems to be related to typescript issue #54593 together with how ava is packaged for dual CJS/ESM
See how 'arethetypeswrong' reports ava's npm package
novemberborn commentedon Mar 19, 2025
@cunneen There is a
defaultproperty though, see these lines:ava/lib/create-chain.js
Lines 104 to 127 in 024de32
zavoloklom commentedon Jul 22, 2025
Just wanted to share a workaround for this issue. You can suppress TypeScript compilation errors in AVA/TSIMP by setting the
TSIMP_DIAGenvironment variable in your AVA config:But this will ignore all TypeScript diagnostics.
sindresorhus commentedon Apr 8, 2026
The issue here is that
entrypoints/main.d.ctsdeclaresexport default test, butentrypoints/main.cjsusesmodule.exports = value— the correct TypeScript declaration for that CJS pattern isexport = test. This mismatch is aFalseExportDefault(confirmed by@arethetypeswrong/cli). TypeScript 5.6 added stricter detection of it, which tsimp now surfaces asTS2349: This expression is not callable.The fix is to change
main.d.ctsto useexport =with the standarddeclare function+declare namespacemerge pattern.That being said, I don't think this is worth fixing. I think it's better to just remove CommonJS support for tests. It's time.
novemberborn commentedon Apr 8, 2026
@sindresorhus do you have time to implement that?
mainneeds a major bump now anyway.IIRC we can require the ESM entrypoint now, so there's no need to have the CJS entrypoint.
sindresorhus commentedon Apr 8, 2026
Yup will do. Would be great with no other commits until then since it will touch a lot of files.
novemberborn commentedon Apr 9, 2026
No need to get rid of all CJS, just change the entrypoint.
Remove CommonJS support
sindresorhus commentedon Apr 9, 2026
I think it's better to do it fully and get everything cleaned up.
#3437
Full ESM internals; bias away from CJS; require @ava/typescript@7