Skip to content

Commit

Permalink
fix: update getLib for new TypeScript targets ES2021, ES2022 (#6782)
Browse files Browse the repository at this point in the history
parser: Update getLib for new TypeScript targets ES2021, ES2022

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed Apr 8, 2023
1 parent 78a5e62 commit 1c04664
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/parser/src/parser.ts
Expand Up @@ -54,10 +54,14 @@ function getLib(compilerOptions: CompilerOptions): Lib[] {
}

const target = compilerOptions.target ?? ScriptTarget.ES5;
// https://github.com/Microsoft/TypeScript/blob/59ad375234dc2efe38d8ee0ba58414474c1d5169/src/compiler/utilitiesPublic.ts#L13-L32
// https://github.com/microsoft/TypeScript/blob/ae582a22ee1bb052e19b7c1bc4cac60509b574e0/src/compiler/utilitiesPublic.ts#L13-L36
switch (target) {
case ScriptTarget.ESNext:
return ['esnext.full'];
case ScriptTarget.ES2022:
return ['es2022.full'];
case ScriptTarget.ES2021:
return ['es2021.full'];
case ScriptTarget.ES2020:
return ['es2020.full'];
case ScriptTarget.ES2019:
Expand Down

0 comments on commit 1c04664

Please sign in to comment.