Further fixes to TypeScript 4.7 instantiation expression parsing (#2201)
This release fixes some additional edge cases with parsing instantiation expressions from the upcoming version 4.7 of TypeScript. Previously it was allowed for an instantiation expression to precede a binary operator but with this release, that's no longer allowed. This was sometimes valid in the TypeScript 4.7 beta but is no longer allowed in the latest version of TypeScript 4.7. Fixing this also fixed a regression that was introduced by the previous release of esbuild:
Code
TS 4.6.3
TS 4.7.0 beta
TS 4.7.0 nightly
esbuild 0.14.36
esbuild 0.14.37
esbuild 0.14.38
a<b> == c<d>
Invalid
a == c
Invalid
a == c
a == c
Invalid
a<b> in c<d>
Invalid
Invalid
Invalid
Invalid
a in c
Invalid
a<b>>=c<d>
Invalid
Invalid
Invalid
Invalid
a >= c
Invalid
a<b>=c<d>
Invalid
a < b >= c
a = c
a < b >= c
a = c
a = c
a<b>>c<d>
a < b >> c
a < b >> c
a < b >> c
a < b >> c
a > c
a < b >> c
This table illustrates some of the more significant changes between all of these parsers. The most important part is that esbuild 0.14.38 now matches the behavior of the latest TypeScript compiler for all of these cases.
Add support for TypeScript's moduleSuffixes field from TypeScript 4.7
The upcoming version of TypeScript adds the moduleSuffixes field to tsconfig.json that introduces more rules to import path resolution. Setting moduleSuffixes to [".ios", ".native", ""] will try to look at the the relative files ./foo.ios.ts, ./foo.native.ts, and finally ./foo.ts for an import path of ./foo. Note that the empty string "" in moduleSuffixes is necessary for TypeScript to also look-up ./foo.ts. This was announced in the TypeScript 4.7 beta blog post.
Match the new ASI behavior from TypeScript nightly builds (#2188)
This release updates esbuild to match some very recent behavior changes in the TypeScript parser regarding automatic semicolon insertion. For more information, see TypeScript issues #48711 and #48654 (I'm not linking to them directly to avoid Dependabot linkback spam on these issues due to esbuild's popularity). The result is that the following TypeScript code is now considered valid TypeScript syntax:
classA<T>{}newA<number>/* ASI now happens here */if(0){}interfaceB{(a: number): typeofa/* ASI now happens here */<T>(): void}
Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.
All Depfu comment commands
@depfu rebase
Rebases against your default branch and redoes this update
@depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@depfu close
Closes this PR and deletes the branch
@depfu reopen
Restores the branch and reopens this PR (if it's closed)
@depfu pause
Ignores all future updates for this dependency and closes this PR
@depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request.
What changed?
✳️ esbuild (0.14.36 → 0.14.38) · Repo · Changelog
Release Notes
0.14.38
0.14.37
Does any of this look wrong? Please let us know.
Commits
See the full diff on Github. The new version differs by 6 commits:
publish 0.14.38 to npm
fix #2201: more ts instantiation expression fixes
publish 0.14.37 to npm
Make TS InstantiationExpr parsing more permissive (#2188)
allow ASI before `<` in typescript type parameters
support `moduleSuffixes` in `tsconfig.json`
Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with
@depfu rebase
.All Depfu comment commands