Open trusktr opened 1 year ago
This would be sweet, because with little restructure of an app, new features could start to import
things and get modern type support and intellisense simply with npm i @types/jquery
without having to configure additional global types.
From a purist module perspective, I can understand we don't want modules to grab things from global. But from a practical standpoint, it seems like it would so incredibly useful, especially for the many many apps that already exist.
I know this goes against the concept of modules, but it feels like something necessary to help people migrate.
where
env:$
causesimport * as jQuery from "jquery"
to import from a global$
variable, and similar withthree
.js.There would be no static analysis in this case. Maybe it would have a runtime check, so that
import {blah} from 'jquery'
would fail if"blah" in $
is false.why
I struggle with these sorts of things often. In a lot of cases I don't want to go and spend (possibly valuable and costly) time refactoring existing apps, but I want an easy way to move forward if I can.