🔎 Search Terms
TypeScript incorrectly thinks the selection constant in the following code could be null:
Playground link
const selection = window.getSelection();
if (selection != null) {
function clearSelection() {
selection.empty(); // <-- TypeScript incorrectly says selection could be null here
}
clearSelection();
}
🕗 Version & Regression Information
v6.0.3
🙁 Actual behavior
A TS18047 error is displayed.
🙂 Expected behavior
No errors should be displayed.
🔎 Search Terms
TypeScript incorrectly thinks the
selectionconstant in the following code could be null:Playground link
🕗 Version & Regression Information
v6.0.3
🙁 Actual behavior
A TS18047 error is displayed.
🙂 Expected behavior
No errors should be displayed.