chore: remove unnecessary empty.d.ts
#11966
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
It looks like the
empty.d.tsfile in type tests does nothing. I think it can be removed safely just to have less noise around.Here is why. By design
tsdis running type checks (or test) on.d.tstype definition files. Not on.tssource, but on.d.tsinside the build artefact. Here injestrepo the type tests are set up exactly like this – the build files are tested.The
empty.d.tsis unofficial work around to run tests on.tsfiles. The thing is thattsdneeds to have have some.d.tsto work. Installtsdin an empty folder and runyarn tsd. It will throw: "The type definitionindex.d.tsdoes not exist. Create one and try again." If an emptyindex.d.tsis added,tsdwill complain that it can’t find any test.Now the interesting part – add a test, but keep
index.d.tsempty. Error: "./index.d.ts is not a module." That’s right! It has no exports, because we kept it empty. Now look atempty.d.tsfile in this repo. No exports. Seems like this even isn’t valid.d.ts. Or?After playing more with
tsdI think thatempty.d.tsis redundant in this repo. Might be I missed something. So let’s check what CI thinks.In general this PR changes nothing. It is just a clean up with very long explanation. Thanks for reading (;
Test plan
After removal all works as expected locally. I was running type test before and after the change with Jest’s cache cleaned and the result is the same. Here I included failing test to avoid false positive. On CI nothing should fail.