Skip to content

Commit 0b85539

Browse files
jessebeachljharbJoshuaKGoldberg
committed
[Fix] Mark ChainExpression as a noop
Co-authored-by: J. Renée Beach <[email protected]> Co-authored-by: Jordan Harband <[email protected]> Co-authored-by: Josh Goldberg <[email protected]>
1 parent 41c2bd3 commit 0b85539

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

__tests__/src/getPropLiteralValue-babelparser-test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ describe('getLiteralPropValue', () => {
168168
});
169169
});
170170

171+
describeIfNotBabylon('Chain Expression', () => {
172+
it('should return null', () => {
173+
const prop = extractProp('<div foo={abc?.def} />');
174+
175+
const expected = null;
176+
const actual = getLiteralPropValue(prop);
177+
178+
assert.equal(actual, expected);
179+
});
180+
});
181+
171182
describe('Template literal', () => {
172183
it('should return template literal with vars wrapped in curly braces', () => {
173184
const prop = extractProp('<div foo={`bar ${baz}`} />');

src/values/expressions/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const LITERAL_TYPES = {
156156
TSAsExpression: noop,
157157
TypeCastExpression: noop,
158158
SequenceExpression: noop,
159+
ChainExpression: noop,
159160
};
160161

161162
/**

0 commit comments

Comments
 (0)