Closed
Description
TypeScript Version: 2.1.4
This code snippet used to compile fine in 2.0 with strictNullChecks
, but now errors in 2.1:
if (documentElement.hasChildNodes() && documentElement.firstChild.nodeName === 'error') {
}
I agree that firstChild
can in fact be null
(even though in this case I checked with hasChildNodes
), but this is a breaking change introduced in a minor version.
Workaround: check with documentElement.firstChild &&
or add a !
in the cases where I know from the protocol that the element will have a child node.
Full file: https://github.com/felixfbecker/vscode-php-debug/blob/master/src/xdebugConnection.ts
Failing build: https://travis-ci.org/felixfbecker/vscode-php-debug/builds/182024998