Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Improve support for `exactOptionalPropertyTypes`

Open Beginner friendly
#265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start by locating the Options<P, C> interface shown in the issue and check how its optional properties are declared and used. Update the optional property types to allow explicit undefined, then run the relevant TypeScript checks or tests to confirm the types accept those assignments under exactOptionalPropertyTypes.

Written by the indexing model from the issue text.

Description

The Options type is defined as:

export interface Options<P, C> {
    /** Minimum zoom level at which clusters are generated. @default 0 */
    minZoom?: number;
    /** Maximum zoom level at which clusters are generated; capped at 30. @default 16 */
    maxZoom?: number;
    /** Minimum number of points to form a cluster. @default 2 */
    minPoints?: number;
    /** Cluster radius, in pixels. @default 40 */
    radius?: number;
    /** (Tiles) Tile extent; radius is calculated relative to this value. @default 512 */
    extent?: number;
    /** Size of the KD-tree leaf node; affects performance. @default 64 */
    nodeSize?: number;
    /** Whether timing info should be logged. @default false */
    log?: boolean;
    /** Whether to generate ids for input features in vector tiles. @default false */
    generateId?: boolean;
    /** Cluster properties for a single point, e.g. `props => ({sum: props.myValue})`. Defaults to identity. */
    map?: (props: P) => C;
    /** Merges two clusters' properties, e.g. `(accumulated, props) => { accumulated.sum += props.sum; }` */
    reduce?: ((accumulated: C, props: Readonly<C>) => void) | null;
}

If I enable exactOptionalPropertyTypes to true, I am no longer able to set map and other properties to undefined. Please consider adding undefined to the optional properties so they can be explicitly set to undefined as well.

Dominant language
JavaScript
Stars
2.4k
Forks
303
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from mapbox/supercluster

All issues in mapbox/supercluster

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.