testdouble / testdouble.js

A minimal test double library for TDD with JavaScript
MIT License
1.42k stars 142 forks source link

Add `types` export condition #490

Closed alexlafroscia closed 2 years ago

alexlafroscia commented 2 years ago

For a TypeScript project that has moduleResolution: "nodenext" set, TypeScript won't respect the existance of an index.d.ts when providing type definitions for a module.

Explicitly adding the "types" condition in the export definition, as supported by TypeScript 4.7 and later, resolves this problem.


I ran into the issue described above while migrating one of my projects to use TypeScript with native ESM. Applying this same fix through a yarn patch resolved the issue for my project; hopefully getting this fix upstream will avoid other people bumping into the same thing that I did!

alexlafroscia commented 2 years ago

Not sure why the test failures happened; it seems like standard timed out while running, in both cases?

searls commented 2 years ago

Indeed. I think we should probably move the repo to github actions, but there's no way this is the reason it's failing so I will just merge and cut a release

searls commented 2 years ago

Landed in testdouble@3.16.6

alexlafroscia commented 2 years ago

Thanks @searls!