Each helper in separate module
See original GitHub issueWhy not put each helper in a separate module and let TypeScript require
only those that are actually needed?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How to import modules for functions held in a separate python ...
I have a python script located in main/src/ that calls another script containing helper functions located in main/misc/ . This path is added...
Read more >Define helper methods in a module - RSpec Core - Relish
You can define helper methods in a module and include it in your example groups using the config.include configuration option. config.extend can be...
Read more >Using modules to encapsulate and reuse resource ...
Helper scripts specified at the module level don't propagate to the individual resources contained in the module when CloudFormation processes the template.
Read more >Modules And Helpers - Codeception Docs
Each module provides methods for testing its own part and by combining modules you can get a powerful setup to test an application...
Read more >CommonJS modules | Node.js v19.3.0 Documentation
js also supports the ECMAScript modules standard used by browsers and other JavaScript runtimes. In Node.js, each file is treated as a separate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just because they do doesn’t mean that this wouldn’t be a good change. This does nothing for browserify users or people using older versions of webpack.
This solution is both relatively easy to switch to and the support is guaranteed.
I am also finding this to be a problem when publishing many small typescript modules. Ideally each utility would have it’s own namespace
require('tslib/$NAME')
.Inlining the code directly means (when publishing a bunch of small modules) a bunch of code is duplicated, however when you use
importHelpers
it means you are incurring at least 2kb gzipped, which is a lot to ask for a module that is say 1kb gzipped.I would personally advocate the approach taken by just however everything doesn’t necessarily need to be in it’s own published package.
It would be even cooler if these utilities could be used (without risk and with official support) in non typescript files to even further decrease duplication. For example in many of modules I require something like just-extend when I could easily use
tslib.__extends
if it were supported.