tsdjs / tsd

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

The type definition `index.d.ts` does not exist. Create one and try again. #135

Open iccicci opened 2 years ago

iccicci commented 2 years ago

Hi all,

my package is written in TypeScript and I create the index.d.ts file only before publishing the package. It seems that to run tsd I'm forced to run tsc at every change.

Is there a way to test types in index.ts file directly without the need to run tsc before tsd?

Thank you

hisuwh commented 2 years ago

I'm mid installing tsd right now but need this feature so might have to uninstall...

iccicci commented 2 years ago

Hi @hisuwh ,

I can suggest you the solution I adopted here: https://github.com/iccicci/sedentary/blob/master/test/98types.ts

Hope this helps

thewilkybarkid commented 2 years ago

Related to #132.

novemberborn commented 2 years ago

TypeScript 4.7 supports export maps, so a type definition no longer has to exist at index.d.ts at all.

tommy-mitchell commented 1 year ago

See #196 for discussion on this.

ddeltree commented 6 months ago

Same here. Whenever I run npx tsd --files src/**/*.test-d.ts, to run the test files I won't include in the dist folder, I get:

The type definition `./dist/index.d.ts` does not exist at `[...]/dist/index.d.ts`. Is the path correct? Create one and try again.

One workaround is to just create an empty file in dist/index.d.ts:

if [ ! -d dist ]; then mkdir dist; fi && touch dist/index.d.ts && tsd --files src/**/*.test-d.ts