tsdjs / tsd

Check TypeScript type definitions
MIT License
2.38k stars 68 forks source link

TSD throws error about not finding typing definitions #151

Closed hasezoey closed 1 year ago

hasezoey commented 2 years ago

Currently having a basic tsd test in my project in test/tests/types/test-init-d.ts and running yarn tsd ./test/tests/types results in tsd throwing a error:

The type definition `lib/typegoose.d.ts` does not exist. Create one and try again.
# or
The test file `lib/typegoose.test-d.ts` or `lib/typegoose.test-d.tsx` does not exist. Create one and try again.

and i have no clue where it tries to search or why it tries to search in lib when the main tsconfig says the outDir is build

Repository i am trying to run tsd in: https://github.com/typegoose/typegoose/tree/tsdError (tsdError branch) to get up and running:

# assumes the repository is cloned and the correct branch is checked-out and the cwd is the project root

yarn install

yarn tsd
# or
yarn tsd ./test/tests/types

From the documentation i would assume that all tsd test files would have to have the suffix of .test-d.ts (or at first i tried -d.ts) by default, though i am confused as to how tsd wants the typings files, does it want the raw .ts files or does it want compiled .d.ts files? and i also am confused as how it tries to read those files, because lib is clearly not build as set in tsconfig.json's outDir

richardscarrott commented 2 years ago

Hi @hasezoey did you ever figure this out?

hasezoey commented 2 years ago

Hi @hasezoey did you ever figure this out?

at least not with tsd(this project here), so i looked for alternatives and found tsd-lite(which has a similar name but is differently structured) and i used more specifically jest-runner-tsd(which uses tsd-lite) because it was "just what i needed" (by using jest) and was easy to integrate

if you want a example where jest-runner-tsd is use (the project i initially searched it for):

richardscarrott commented 2 years ago

@hasezoey Excellent, that's exactly what I'm after thanks for the pointers 👍