Compiler Options Lib in tsconfig.json File - Typescript-config/is-valid

171 views Asked by At

I get this error when initalizing my react native android project from the tsconfig.json file:

'compilerOptions/lib/2' must be equal to one of the allowed values 'ES5, ES6, ES2015, ES2015.Collection, ES2015.Core, ES2015.Generator, ES2015.Iterable, ES2015.Promise, ES2015.Proxy, ES2015.Reflect, ES2015.Symbol.WellKnown, ES2015.Symbol, ES2016, ES2016.Array.Include, ES2017, ES2017.Intl, ES2017.Object, ES2017.SharedMemory, ES2017.String, ES2017.TypedArrays, ES2018, ES2018.AsyncGenerator, ES2018.AsyncIterable, ES2018.Intl, ES2018.Promise, ES2018.Regexp, ES2019, ES2019.Array, ES2019.Intl, ES2019.Object, ES2019.String, ES2019.Symbol, ES2020, ES2020.BigInt, ES2020.Promise, ES2020.String, ES2020.Symbol.WellKnown, ESNext, ESNext.Array, ESNext.AsyncIterable, ESNext.BigInt, ESNext.Intl, ESNext.Promise, ESNext.String, ESNext.Symbol, DOM, DOM.Iterable, ScriptHost, WebWorker, WebWorker.ImportScripts, Webworker.Iterable, ES7, ES2021, ES2020.SharedMemory, ES2020.Intl, ES2021.Promise, ES2021.String, ES2021.WeakRef, ESNext.WeakRef, es2021.intl, ES2022, ES2022.Array, ES2022.Error, ES2022.Intl, ES2022.Object, ES2022.String'. Value found '"es2020.date"'. Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]7$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2015(.([Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Cc][Oo][Rr][Ee]|[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Pp][Rr][Oo][Xx][Yy]|[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ss][Yy][Mm][Bb][Oo][Ll].[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2016(.[Aa][Rr][Rr][Aa][Yy].[Ii][Nn][Cc][Ll][Uu][Dd][Ee])?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2017(.([Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2018(.([Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Rr][Ee][Gg][Ee][Xx][Pp]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2019(.([Aa][Rr][Rr][Aa][Yy]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2020(.([Bb][Ii][Gg][Ii][Nn][Tt]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll].[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2021(.([Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss]2022(.([Aa][Rr][Rr][Aa][Yy]|[Ee][Rr][Rr][Oo][Rr]|[Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]))?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ee][Ss][Nn][Ee][Xx]Tt?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Dd][Oo]Mm?$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]$'. Value found 'es2020.date' Or 'compilerOptions/lib/2' must match pattern '^[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee]Rr?$'. Value found 'es2020.date'

This occurs from this code:

{
  "extends": "@tsconfig/react-native/tsconfig.json"
}

I tried adding the compiler options as requested this is through doing some research on forums and also looking closely on the error/problem.

{
  "extends": "@tsconfig/react-native/tsconfig.json",
  "compilerOptions": {
    "lib": ["ES2022"]
  }
}

Though i still get issues in my code with the same error.

I also tweaked the lib to "ES2015", "ES2021" e.t.c but still error persists

0

There are 0 answers