Skip to content

Commit

Permalink
feat: add support for target ES2022
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Apr 12, 2022
1 parent 619f7c4 commit 6eec842
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"preversion": "npm run lint && pnpm run build",
"version": "pnpm run preversion && pnpm run generate:all && git add .",
"release": "np --no-cleanup --no-yarn --no-tests",
"update:check": "pnpx npm-check-updates -x typescript-* --dep dev,prod",
"update:check": "pnpx npm-check-updates -x typescript-*,ava,chalk --dep dev,prod",
"update:commit": "pnpx npm-check-updates -u -x typescript-*,ava,chalk --dep dev,prod && pnpm update && pnpm install"
},
"keywords": [
Expand Down Expand Up @@ -104,7 +104,7 @@
"@rollup/pluginutils": "^4.2.0",
"@wessberg/stringutil": "^1.0.19",
"browserslist": "^4.20.2",
"browserslist-generator": "^1.0.65",
"browserslist-generator": "^1.0.66",
"chalk": "4.1.2",
"compatfactory": "^0.0.13",
"crosspath": "1.0.0",
Expand Down
28 changes: 8 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,18 @@ export function getScriptTargetFromBrowserslist(browserslist: string[], typescri
);
// Support older TypeScript versions that may not supported ES2021 as a ScriptTarget with nullish coalescing
case "es2021":
return (
typescript.ScriptTarget.ES2021 ??
typescript.ScriptTarget.ES2020 ??
typescript.ScriptTarget.ES2019 ??
typescript.ScriptTarget.ES2018 ??
typescript.ScriptTarget.ES2017 ??
typescript.ScriptTarget.ES2016 ??
typescript.ScriptTarget.ES2015
);
case "es2022":
return (
typescript.ScriptTarget.ES2022 ??
typescript.ScriptTarget.ES2021 ??
typescript.ScriptTarget.ES2020 ??
typescript.ScriptTarget.ES2019 ??
Expand Down Expand Up @@ -75,9 +85,11 @@ export function getEcmaVersionForScriptTarget(
return "es2020";
case typescript.ScriptTarget.ES2021:
return "es2021";
case typescript.ScriptTarget.ES2022:
return "es2022";
case typescript.ScriptTarget.ESNext:
case typescript.ScriptTarget.Latest:
case typescript.ScriptTarget.JSON:
return "es2021";
return "es2022";
}
}

0 comments on commit 6eec842

Please sign in to comment.