-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript-estree): correct parenthesized optional chain AST (#1141)
- Also fixes the package not working in the browser: - ts.sys undefined in the browser - process is undefined in the browser - Whitelist 3.7.1-rc
- Loading branch information
1 parent
1508670
commit 5ae286e
Showing
11 changed files
with
9,915 additions
and
874 deletions.
There are no files selected for viewing
1,687 changes: 1,542 additions & 145 deletions
1,687
packages/parser/tests/lib/__snapshots__/typescript.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function processOptionalCallParens(one?: any) { | ||
(one?.fn()); | ||
(one?.two).fn(); | ||
(one.two?.fn()); | ||
(one.two?.three).fn(); | ||
(one.two?.three?.fn()); | ||
|
||
(one?.()); | ||
(one?.())(); | ||
(one?.())?.(); | ||
|
||
(one?.()).two; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...ared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function processOptionalElementParens(one?: any) { | ||
(one?.[2]); | ||
(one?.[2])[3]; | ||
(one[2]?.[3]); | ||
(one[2]?.[3])[4]; | ||
(one[2]?.[3]?.[4]); | ||
(one[2]?.[3]?.[4])[5]; | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function processOptionalParens(one?: any) { | ||
(one?.two); | ||
(one?.two).three; | ||
(one.two?.three); | ||
(one.two?.three).four; | ||
(one.two?.three?.four); | ||
(one.two?.three?.four).five; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.