question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Each helper in separate module

See original GitHub issue

Why not put each helper in a separate module and let TypeScript require only those that are actually needed?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
DylanPierceycommented, Oct 24, 2017

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.

2reactions
DylanPierceycommented, Oct 22, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found