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.ts
file in type tests does nothing. I think it can be removed safely just to have less noise around.Here is why. By design
tsd
is running type checks (or test) on.d.ts
type definition files. Not on.ts
source, but on.d.ts
inside the build artefact. Here injest
repo the type tests are set up exactly like this – the build files are tested.The
empty.d.ts
is unofficial work around to run tests on.ts
files. The thing is thattsd
needs to have have some.d.ts
to work. Installtsd
in an empty folder and runyarn tsd
. It will throw: "The type definitionindex.d.ts
does not exist. Create one and try again." If an emptyindex.d.ts
is added,tsd
will complain that it can’t find any test.Now the interesting part – add a test, but keep
index.d.ts
empty. Error: "./index.d.ts is not a module." That’s right! It has no exports, because we kept it empty. Now look atempty.d.ts
file in this repo. No exports. Seems like this even isn’t valid.d.ts
. Or?After playing more with
tsd
I think thatempty.d.ts
is 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.