Skip to content

Commit 46ea596

Browse files
committed
fix #3762: add es2023 as an alias for es2022
1 parent e876394 commit 46ea596

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
* Allow `es2023` as a target environment ([#3762](https://github.com/evanw/esbuild/issues/3762))
6+
7+
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.
8+
39
## 0.21.1
410

511
* Fix a regression with `--keep-names` ([#3756](https://github.com/evanw/esbuild/issues/3756))

internal/resolver/tsconfig_json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func ParseTSConfigJSON(
213213
switch lowerValue {
214214
case "es3", "es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021":
215215
result.Settings.Target = config.TSTargetBelowES2022
216-
case "es2022", "esnext":
216+
case "es2022", "es2023", "esnext":
217217
result.Settings.Target = config.TSTargetAtOrAboveES2022
218218
default:
219219
ok = false

pkg/api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const (
132132
ES2020
133133
ES2021
134134
ES2022
135+
ES2023
135136
)
136137

137138
type Loader uint16

pkg/api/api_impl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ func validateFeatures(log logger.Log, target Target, engines []Engine) (compat.J
305305
constraints[compat.ES] = compat.Semver{Parts: []int{2021}}
306306
case ES2022:
307307
constraints[compat.ES] = compat.Semver{Parts: []int{2022}}
308+
case ES2023:
309+
constraints[compat.ES] = compat.Semver{Parts: []int{2023}}
308310
case ESNext, DefaultTarget:
309311
default:
310312
panic("Invalid target")

pkg/cli/cli_impl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,7 @@ func parseTargets(targets []string, arg string) (target api.Target, engines []ap
980980
"es2020": api.ES2020,
981981
"es2021": api.ES2021,
982982
"es2022": api.ES2022,
983+
"es2023": api.ES2023,
983984
}
984985

985986
outer:

0 commit comments

Comments
 (0)