tsdx icon indicating copy to clipboard operation
tsdx copied to clipboard

[Feature] re-export self defined `.d.ts` files

Open swyxio opened this issue 6 years ago • 7 comments

Current Behavior

say i'm using a library that has no typings. so i have to make my own .d.ts file:

image

however once i build my project, the reference is gone:

image

Expected behavior

copy over or bundle self defined .d.ts files? I'm sorry I don't really know the terminology or what people normally do for this stuff as I am quite a newbie at publishing TS libs.

Suggested solution(s)

see above

Additional context

TSDX is the best!

Your environment

n/a

swyxio avatar May 26 '19 01:05 swyxio

cc @hedgerh and @aleclarson as i feel you two probably know what i should be doing in this scenario..

swyxio avatar May 26 '19 01:05 swyxio

I haven't dealt with this, either, but I'm looking into it. Seems like it's pretty easy if it's published to DefinitelyTyped, you can just declare it as a dependency. Also, from what I'm reading, it kind of sounds like Typescript will swoop up any typedefs that are in the root of your project? I'm not sure, though.

hedgerh avatar May 26 '19 01:05 hedgerh

This part from the TS publishing doc is interesting, though. I can't tell if it's saying to not include your own non-published typedefs of a dependency?

image

hedgerh avatar May 26 '19 01:05 hedgerh

yeah i couldnt parse it either. :(

i did submit my .d.ts files up to DefinitelyTyped, but am wondering what I'm supposed to do in the meantime. for now, VSCode is showing an error but typescript is still inferring any for this definition that it can't find. i wonder if this is how its supposed to be.

swyxio avatar May 26 '19 02:05 swyxio

I think you need to copy .d.ts modules into dist/ manually (which is what react-spring does).

aleclarson avatar May 26 '19 20:05 aleclarson

Any updates on this? I was unsuccessful when copying my custom typings to dist/. It appears in 0.11.0 the folder gets cleared out on each build.

seanemmer avatar Nov 18 '19 23:11 seanemmer

we need to make this a new feature.

swyxio avatar Dec 04 '19 09:12 swyxio