fix: explored-types: add 'type' to core types import, silencing webpack empty export warning #699
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.
In creating this PR: #698
I discovered a webpack-related warning for our import of core types in the
explored-types
. By doing:this led to an avalanche of warnings like so:
By adding the 'type' at the top of
types.ts
:this warning no longer sounds. I believe this has to do with some bare metal typescript -> javascript transpilation + importing rules at the webpack level. There was no obvious bug/misbehavior as a result of the former implementation. The library worked, from what I tested, and types were valid/enforced, even with this warning.
In terms of where to put the
type
keyword, I believe from testing one could also do it here:but I like it at the import better. Everything 'up the tree' or neighboring (but also importing from) either explicitly defines a type to export, uses these core imported types, and/or uses primitives. In some sense, putting it at the import strikes at "a single source of truth"--our core types. This import is the parent of everything in this library beyond primitives, so it seems right at this spot.
For more information about the warning/solution, see this comment and the rest of the thread.