jspreadsheet / jspreadsheet/ce

getSelection may return null but type definition does not reflect this

Open Beginner friendly
#1,788 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.