pzavolinsky / ts-unused-exports

ts-unused-exports finds unused exported symbols in your Typescript project
MIT License
749 stars 49 forks source link

Fix --allowUnusedTypes not applying to type re-exports #181

Closed kachkaev closed 3 years ago

kachkaev commented 3 years ago

Kind: patch. Closes #180.

Out of scope: analyzing export { v, T } from "./x" and excluding types from such re-exports. Only export type { T } from "./x" is covered by this PR.

Using export type for re-exporting types is a requirement when isolatedModules is set to true (docs).

kachkaev commented 3 years ago

Just realised that I haven’t added the CHANGELOG entry as suggested in CONTRIBUTING.md. This is done now.

Multiple commits were also squashed into one. Doing so was quite painful (as always) and so it’d be great if this repo was configured to squash PRs on merge instead 🙂

kachkaev commented 3 years ago

ping @mrseanryan @pzavolinsky 🙂

mrseanryan commented 3 years ago

@kachkaev am super busy - hope to have a look Thursday...

mrseanryan commented 3 years ago

hi @kachkaev

nice PR !

a couple of questions:

1.

Using export type for re-exporting types is a requirement when isolatedModules is set to true (docs).

I'm sure you are right! - but where in the docs is that? 🤔

2.

Multiple commits were also squashed into one. Doing so was quite painful (as always) and so it’d be great if this repo was configured to squash PRs on merge instead 🙂

When we merge to master, there is a special button to do that - so not sure if we need to change anything there ...

[fixed!] BUT maybe we should update the CONTRIB....

  1. Can you please add unit tests also for type ? (since it should behave similarly for interface)

  2. I think we have similar problem for --allowUnusedEnums and enum. I will have a look ... BUT I think this can be separate issue/PR ...

kachkaev commented 3 years ago

Hi @mrseanryan, thanks for your reply! Just noticed you’ve created #184, which uses code from this PR. Feel free to close this one and continue there if this makes things easier 😉

mrseanryan commented 3 years ago

update:

@kachkaev -> RE 3 - I see actually you already support type in the tests :) - Thanks.

Also there is a similar bug for enum.

So, I opened a new PR that addresses enum, and gets this useful fix from @kachkaev through.

PR = https://github.com/pzavolinsky/ts-unused-exports/pull/184