react-native-community/react-native-template-typescript

React Native 69 will use iOS 12.4 as minimal version but we still recommends es2017 in TS config

retyui opened this issue · 3 comments

We still recommend to use lib: es2017 in ts config, but a new minimal iOS version for RN@0.69.x is 12.4

// iOS 11
Intl.PluralRules // undefined (es2018.intl)
Symbol.asyncIterator // undefined (es2018.asynciterable)
String.prototype.trimStart // undefined (es2019.string)
String.prototype.trimEnd // undefined (es2019.string)
Object.fromEntries // undefined (es2019.object)
Array.prototype.flat // undefined (es2019.array)
Array.prototype.flatMap // undefined (es2019.array)

// iOS 12.4
Intl.PluralRules // function
Symbol.asyncIterator // Symbol(Symbol.asyncIterator)
String.prototype.trimStart // function
String.prototype.trimEnd // function
Object.fromEntries // function
Array.prototype.flat // function
Array.prototype.flatMap // function

So, can we update es2017 => es2019 as all es2019 features implemented in Hermes, iOS 12.4 and jsc-android ? (see "Compare table")

Links

We can upgrade, but I'm not sure if it matters so much as it's babel and https://github.com/facebook/metro/tree/main/packages/metro-react-native-babel-preset that transpiles the code before it actually runs on the device. But I might be wrong.

@radko93 Babel can make impact for new syntax that can't be Polyfilled for example:

const value = 100_000_000; // numeric separators
async function asynFn(){ await my(); } // async/await
function* generator(){ yield i; } // Generator Function 

but in case of new methods, what Babel can matters here:

Object.fromEntries(...)
//     ^^^^^^^^^^ TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. 
//                Do you need to change your target library? 
//                Try changing the 'lib' compiler option to 'es2019' or later.

Then probably we can change it once we update for 0.69.