jspreadsheet / jspreadsheet/ce
getSelection may return null but type definition does not reflect this
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 890
- PR merge metrics
- No merged PRs in 30d
Description
I noticed that getSelection can return null in the implementation, but the type definition in index.d.ts does not reflect this possibility.
Source code (shows possible null return):
https://github.com/jspreadsheet/ce/blob/7668cf06a067476f430b5f10cacda77c989fdd3f/src/utils/selection.js#L672
Type definition (does not include null in its type):
https://github.com/jspreadsheet/ce/blob/7668cf06a067476f430b5f10cacda77c989fdd3f/dist/index.d.ts#L1720
The type definition should be updated to indicate that getSelection may return null. For example:
getSelection: () => [number, number, number, number] | null;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/utils/selection.js around line 672 and compare it with the getSelection declaration in dist/index.d.ts around line 1720. Update the declaration so it represents the null case shown by the implementation, then verify that the resulting type matches the documented return possibilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100