Typescript's lib includes "esnext"
See original GitHub issueHello,
I am confused by "esnext"
in lib
for TypeScript.
"lib": [
"dom",
"dom.iterable",
"esnext"
],
Does this mean I can use e.g. flatMap
? Who provides the polyfill?
Background: I am in the process of migration from CRA-TS
to CRA2
. Previously we implemented our own flatMap
and used es6
as library.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TSConfig Option: lib - TypeScript
lib. TypeScript includes a default set of type definitions for built-in JS APIs (like ... ESNext, Additional APIs available in ESNext - This...
Read more >Using ES6 and ESNext with TypeScript - Egghead.io
That said it is super easy to configure TypeScript to use ES6 or ESNext using the lib option. We also cover how to...
Read more >Using 'ESNext' as a TypeScript lib option screws up the react ...
This is really interesting question. From my understanding, the issue isn't from esnext lib. The real issue is from missing DOM library ......
Read more >Compiler Options - Microsoft Open Source
The value ESNext refers to whatever the highest version TypeScript supports at the time is. This setting should be used with caution, since...
Read more >"Enable library es2021.promise in tsconfig.json" quickfix adds ...
TSError: ⨯ Unable to compile TypeScript: error TS6046: Argument for '--lib' ... 'esnext.bigi nt', 'esnext.string', 'esnext.promise', 'esnext.weakref'. at ...
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 Free
Top 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
The behavior of
lib
is no different than using the TypeScript compiler by itself. It only specifies which APIs that you “claim” will be available at runtime. This means you can use things likeMap
,Set
,Promise
, etc and TypeScript will know what those APIs are. You can customizelib
to suit your project.lib
doesn’t provide any polyfills. You will need to do that separately depending on the APIs you’re using and your target browsers. As a side note the TypeScript compiler isn’t used in CRA to compile code, and is only used for type checking.Thanks for detailed explanation! Back to
es6
for me… the future is still not there 😃