Cleaned up elements of importing dungeoneerCommon #20
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.
After playing around with this for a while I've got dungeoner-common to a more pleasant place. Still not perfect but better.
Looking at how other modules do it, it seems they like to export everything from index. So now the index.ts of dungeoneerCommon looks like this:
And I've put the dungeoneerSchame const in
src/schema
, which feels logical.The only thing I don't like is having to put the ".js" extension for the modules to be recognised. Even though the .js files are actually empty for a lot of these because they are only type declarations. Despite this, typescript is able to figure it out (I suppose through the .d.ts files?) and in fact the ts imports fail if these .js exports aren't included. Honestly I'm just a bit confused but whatever.
The nice thing about this way of doing this is that
becomes just
Which looks nicer to me.
The main thing is I can put functions and variables wherever I want in imported packages now. I'm still at a bit of a loss, to tell the truth.