
jQuery Core: Migrate from AMD to ES modules - tannhaeuser
https://github.com/jquery/jquery/commit/d0ce00cdfa680f1f0c38460bc51ea14079ae8b07
======
mzgol
A nice thing is you can import from `src/jquery.js` directly from the browser
without any build process in every modern browser.

[https://gist.github.com/mgol/af95c1358d4ca9f2d45db4f0c55a74a...](https://gist.github.com/mgol/af95c1358d4ca9f2d45db4f0c55a74a4)

[https://twitter.com/m_gol/status/1196893162859573250](https://twitter.com/m_gol/status/1196893162859573250)

------
have_faith
Does anyone know if there is any effort to move jQuery development towards
using TypeScript or something similar? For some reason I had assumed they
probably already were.

~~~
mzgol
Some of jQuery APIs wouldn't be that easy to convert to TS internally, we'd
have to have lots of casting and most likely file size would suffer and that's
one thing we care a lot about in the jQuery team. Plus, that would be a
barrier for some contributors.

The @types/jquery package is maintained quite well so TS users can consume a
typed jQuery anyway.

So, no plans to switch to TypeScript (or to ES6+ with the exception for
imports) for now.

~~~
skrebbel
Not to take anything away from your larger point, but TypeScript doesn't have
not casting, it has type assertions. This matters because casting means "turn
it into this type", which generates code. A type assertions only means "assume
it's this type". It gets removed at compile time, plus any intermediate
variables you might need to create to avoid the occasional type assertion
monstrosity will be appropriately cleaned up by any minifier.

In short, I strongly doubt that the need for type assertions would
meaningfully impact jQuery file size.

~~~
mzgol
Thanks for the terminology fix. With lots of these assertions, especially in
the form of `x as unknown as TheProperType` we wouldn't have to increase file
size but that would nullify most of the TypeScript gains and would make the
code more readable. If we wanted to make internal code more in line with what
TypeScript expects, that would require code changes which I expect may
increase the file size, though.

I haven't done any real testing on the jQuery code base but that's my
experience working on some TypeScript projects.

------
elmo2you
I'm a bit dyslectic (and yes, pedantic too), but isn't that commit d0ce00?
(d0ce00 != d0c00)

~~~
tannhaeuser
OP here and it seems I'm even more dyslectic :)

