DEV Community

Cover image for How to configure a `lib` option of tsconfig.json for React Native
Davyd NRB
Davyd NRB

Posted on • Updated on

How to configure a `lib` option of tsconfig.json for React Native

By default official react native typescript template and @tsconfig/react-native uses "lib": ["es2017"]

If you want to set newer level the next tables can help you identify an individual library component or to know what iOS version supports new functions/proposals

Note:

  • React Native on Android will use a JavaScriptCore version from npm jsc-android

  • React Native on iOS will use JavaScriptCore that provided by operating system. So, different iOS versions include a different JSC engine


es2020

Android (RN version) 0.60.x 0.61.x 0.62.x 0.63.x 0.64.x 0.65.x
BigInt (es2020.bigint)
BigInt64Array (es2020.bigint)
BigUint64Array (es2020.bigint)
Promise.allSettled() (es2020.promise)
str.matchAll(/regex/g) (es2020.string)
Symbol.matchAll (es2020.symbol.wellknown)
iOS version 11.0 11.4 12.0 12.4 13.0 14.4
BigInt (es2020.bigint)
BigInt64Array (es2020.bigint)
BigUint64Array (es2020.bigint)
Promise.allSettled() (es2020.promise)
str.matchAll(/regex/g) (es2020.string)
Symbol.matchAll (es2020.symbol.wellknown)

es2019

Android (RN version) 0.60.x 0.61.x 0.62.x 0.63.x 0.64.x 0.65.x
Array.prototype.flat (es2019.array)
Array.prototype.flatMap (es2019.array)
Object.fromEntries (es2019.object)
String.prototype.trimEnd (es2019.string)
String.prototype.trimStart (es2019.string)
String.prototype.trimLeft (es2019.string)
String.prototype.trimRight (es2019.string)
Symbol.prototype.description (es2019.symbol)
iOS version 11.0 11.4 12.0 12.4 13.0 14.4
Array.prototype.flat (es2019.array)
Array.prototype.flatMap (es2019.array)
Object.fromEntries (es2019.object)
String.prototype.trimEnd (es2019.string)
String.prototype.trimStart (es2019.string)
String.prototype.trimLeft (es2019.string)
String.prototype.trimRight (es2019.string)
Symbol.prototype.description (es2019.symbol)

es2018

Android (RN version) 0.60.x 0.61.x 0.62.x 0.63.x 0.64.x 0.65.x
async function* () { ... } (es2018.asyncgenerator)
for await (let value of range) { ... } (es2018.asynciterable)
Symbol.asyncIterator (es2018.asynciterable)
Intl.PluralRules (es2018.intl)
RegExp.dotAll (es2018.regexp)
Promise.prototype.finally (es2018.promise)
iOS version 11.0 11.4 12.0 12.4 13.0 14.4
async function* () { ... } (es2018.asyncgenerator)
for await (let value of range) { ... } (es2018.asynciterable)
Symbol.asyncIterator (es2018.asynciterable)
Intl.PluralRules (es2018.intl)
RegExp.dotAll (es2018.regexp)
Promise.prototype.finally (es2018.promise)

es2017

Android (RN version) 0.60.x 0.61.x 0.62.x 0.63.x 0.64.x 0.65.x
SharedArrayBuffer (es2017.sharedmemory)
Atomics (es2017.typedarrays)
Uint8Array (es2017.typedarrays)
Uint8ClampedArray (es2017.typedarrays)
Int16Array (es2017.typedarrays)
Uint16Array (es2017.typedarrays)
Int32Array (es2017.typedarrays)
Uint32Array (es2017.typedarrays)
Float32Array (es2017.typedarrays)
Float64Array (es2017.typedarrays)
Int8Array (es2017.typedarrays)
Intl.DateTimeFormat.prototype.formatToParts(date) (es2017.intl)
Object.getOwnPropertyDescriptors(obj) (es2017.object)
Object.values(obj) (es2017.object)
Object.entries(obj) (es2017.object)
String.prototype.padEnd (es2017.string)
String.prototype.padStart (es2017.string)
iOS version 11.0 11.4 12.0 12.4 13.0 14.4
SharedArrayBuffer (es2017.sharedmemory)
Atomics (es2017.typedarrays)
Uint8Array (es2017.typedarrays)
Uint8ClampedArray (es2017.typedarrays)
Int16Array (es2017.typedarrays)
Uint16Array (es2017.typedarrays)
Int32Array (es2017.typedarrays)
Uint32Array (es2017.typedarrays)
Float32Array (es2017.typedarrays)
Float64Array (es2017.typedarrays)
Int8Array (es2017.typedarrays)
Intl.DateTimeFormat.prototype.formatToParts(date) (es2017.intl)
Object.getOwnPropertyDescriptors(obj) (es2017.object)
Object.values(obj) (es2017.object)
Object.entries(obj) (es2017.object)
String.prototype.padEnd (es2017.string)
String.prototype.padStart (es2017.string)

es2016

Android (RN version) 0.60.x 0.61.x 0.62.x 0.63.x 0.64.x 0.65.x
Array.prototype.includes (es2016.array)
iOS version 11.0 11.4 12.0 12.4 13.0 14.4
Array.prototype.includes (es2016.array)

es2015

Android (RN version) 0.60.x 0.61.x 0.62.x 0.63.x 0.64.x 0.65.x
Symbol (es2015.symbol)
Reflect (es2015.reflect)
Proxy (es2015.proxy)
Promise (es2015.promise)
Map (es2015.collection)
Set (es2015.collection)
function* (){ ... } (es2015.generator)
Symbol.iterator (es2015.iterable)
iOS version 11.0 11.4 12.0 12.4 13.0 14.4
Symbol (es2015.symbol)
Reflect (es2015.reflect)
Proxy (es2015.proxy)
Promise (es2015.promise)
Map (es2015.collection)
Set (es2015.collection)
function* (){ ... } (es2015.generator)
Symbol.iterator (es2015.iterable)

Top comments (0)