Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Typescript] Typings files not concatenated? #239

Closed
thekevinscott opened this issue Nov 2, 2018 · 4 comments
Closed

[Typescript] Typings files not concatenated? #239

thekevinscott opened this issue Nov 2, 2018 · 4 comments

Comments

@thekevinscott
Copy link

Hi there,

It looks like when using Typescript, typings files are being emitted that match the files on disk, instead of being concatenated to a single file. I've set up a repo here demonstrating.

So, for instance, you've got a src directory with:

- /src
  - index.ts
  - foo.ts

This creates a dist directory with:

- /dist
  - foo.d.ts
  - index.d.ts
  - index.js
  - index.js.map
  - index.mjs
  - index.mjs.map
  - index.umd.js
  - index.umd.js.map

My understanding with the Typescript compiler is that, when emitting to a single file, typings should be emitted to a single d.ts file as well. But they are not here.

@ForsakenHarmony
Copy link
Collaborator

Well, that's not something we configured

I know it happens but doesn't cause any problems for me

@thekevinscott
Copy link
Author

Is there a way to override the default tsconfig? I tried adding an outFile in the tsconfig but that introduced other errors.

@ForsakenHarmony
Copy link
Collaborator

If you don't get any problems because of it I'd say just leave it be

@oxmanroman
Copy link

This actually generates problems when having typescript files across multiple directories.

For instance:

- /src
  - /cars
      - cars.ts
  - index.ts

Microbundle will then generate:

- /dist
  - /cars
      - cars.d.ts
  - index.d.ts
  - index.js
  - ...

This simply won't work because the whole js code is bundled into the index.js but the definitions are nested into directories.
So doing import { Car } from 'my-lib' won't have types because they are actually inside my-lib/cars.
And doing import { Car } from 'my-lib/cars' won't get to the js code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants