This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
Environment options? (Globals and safety) #328
Unanswered
mindplay-dk
asked this question in
Q&A
Replies: 1 comment 1 reply
-
you can grab types from here https://github.com/JSMonk/hegel/tree/master/packages/typings |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm looking to try Hegel on a project where browser requirements are extremely important.
That is, this projects targets a very specific set of browsers, and browser features.
I noticed the environment configuration setting, which lets you switch between
nodejs
andbrowser
- it leaves me wondering, what's implied bybrowser
exactly?I guess I was expecting more options, along the lines of Typescript's
--lib
option, which lets you target different browser standards and feature proposals and so on. Where does Hegel get it's type-definitions for browser globals?It's critical to the management of this project that any dependency on browser globals be completely explicit, centrally managed, and fully opt-in. For example, if we've decided not to use
Promise
, it's critical that someone can't jump in on this project and accidentally introduce a dependency onPromise
just, say, out of habit. The build should fail.I do plan to use ponyfills for this project, almost exclusively - so maybe the best approach is to use Hegel with no environment? Which seems to be the default. I would then explicitly export every browser global (or ponyfills) from modules, and import these everywhere else, avoiding all global references.
But let's say, for example, I put
fetch
or a ponyfill behind a module - then where do I get the type ofwindow.fetch
from?Thanks :-)
Beta Was this translation helpful? Give feedback.
All reactions