Skip to content

Commit

Permalink
fix #3762: add es2023 as an alias for es2022
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed May 12, 2024
1 parent e876394 commit 46ea596
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

* Allow `es2023` as a target environment ([#3762](https://github.com/evanw/esbuild/issues/3762))

TypeScript recently [added `es2023`](https://github.com/microsoft/TypeScript/pull/58140) as a compilation target, so esbuild now supports this too. There is no difference between a target of `es2022` and `es2023` as far as esbuild is concerned since the 2023 edition of JavaScript doesn't introduce any new syntax features.

## 0.21.1

* Fix a regression with `--keep-names` ([#3756](https://github.com/evanw/esbuild/issues/3756))
Expand Down
2 changes: 1 addition & 1 deletion internal/resolver/tsconfig_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func ParseTSConfigJSON(
switch lowerValue {
case "es3", "es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021":
result.Settings.Target = config.TSTargetBelowES2022
case "es2022", "esnext":
case "es2022", "es2023", "esnext":
result.Settings.Target = config.TSTargetAtOrAboveES2022
default:
ok = false
Expand Down
1 change: 1 addition & 0 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const (
ES2020
ES2021
ES2022
ES2023
)

type Loader uint16
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/api_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ func validateFeatures(log logger.Log, target Target, engines []Engine) (compat.J
constraints[compat.ES] = compat.Semver{Parts: []int{2021}}
case ES2022:
constraints[compat.ES] = compat.Semver{Parts: []int{2022}}
case ES2023:
constraints[compat.ES] = compat.Semver{Parts: []int{2023}}
case ESNext, DefaultTarget:
default:
panic("Invalid target")
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/cli_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ func parseTargets(targets []string, arg string) (target api.Target, engines []ap
"es2020": api.ES2020,
"es2021": api.ES2021,
"es2022": api.ES2022,
"es2023": api.ES2023,
}

outer:
Expand Down

0 comments on commit 46ea596

Please sign in to comment.