Closed
Description
The autofix of rule "prefer-optional-chain" in eslint-plugin is not safe in this case:
source code:
// foo is null here
const value = foo && foo.value;
// value is null in source code
if (value === null) {
// code here
}
autofixed code:
// foo is null here
const value = foo?.value;
// value will be undefined in autofix code
if (value === null) {
// code here
}