Are you willing to submit a PR to fix? Yes
Requested priority: High
Products/sites affected: (if applicable)
ISelection getSelectedIndices() fails to complie due strictNullCheck in tsconfig.json.
Compilation failed with error Object is possibly 'undefined'.
Method should return an empty number array similar to getSelection() returns an empty object array
馃憢 @trevonmckay
Looking at 5.82.0, getSelectedIndices seems to always return number[]. Perhaps it was patched between 5.80.0 ~ 5.82.0. Though it looks to have been untouched for awhile:
Hi @KevinTCoughlin I think the interface is what is causing the tslint strictNullChecks error.
I notice the interface is written as
getSelectedIndices?(): number[]; // TODO make non-optional on next breaking change
but the actual implementation is
getSelectedIndices(): number[]
but given there's a TODO, it appears someone is aware of it.
Raised a PR with the interface change and my understanding of the scope here.
Hi @trevonmckay, can you paste the error in its entirety from the Typescript compiler with strictNullChecks turned on, and the relevant line the error message references?
The interface that you pasted is not saying that getSelectedIndices might return undefined, but rather, that getSelectedIndices is an optional member. FWIW, we currently do have strictNullChecks enabled in OUFR at the moment.
While the breaking change of making it non-optional might help mitigate the issue you're experiencing, perhaps the fix lies in "user land"...
Going to close this as it does seem to be a user env related issue and we closed the other issue that was mentioned. Happy to re-open with add'tl context / repro.