-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): wrong this in function call expr in optional chains
- Loading branch information
LongYinan
committed
Sep 6, 2020
1 parent
1ca71c6
commit 5d9966f
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
packages/integrate/__tests__/optional-call/optional-chain-function-call.spec.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,17 @@ | ||
import test from 'ava' | ||
|
||
test('optional chain function call', (t) => { | ||
const obj = { | ||
a: { | ||
b: { | ||
c: function () { | ||
return this.foo | ||
}, | ||
foo: 2, | ||
}, | ||
foo: 1, | ||
}, | ||
} | ||
|
||
t.is(obj?.a?.b?.c(), 2) | ||
}) |