CesiumGS / CesiumGS/cesium

[request] generic `Property` TS type

Open
#8,930 7 comments 0 reactions 0 assignees View on GitHub
category - typescript
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

I suggest that adding a type parameter to Property class type in `Cesium.d.ts`:

```ts
export class Property {
constructor();
readonly isConstant: boolean;
readonly definitionChanged: Event;
getValue(time: JulianDate, result?: T): T;
equals(other?: Property): boolean;
}
```

Why:

Currently Property's value is any, so it is loose. We can use the types to more tightly constrain the content of a Property.

Notes:

- I know type definitions are generated from JSDocs, but I don't know how to represent generic type in JSDoc...
- Setting the default type parameter to `any` is good idea because it will prevent to compromise compatibility.

Contributor guide

Open the contributing guide

Research direction

Start with the Property declaration in Cesium.d.ts and trace how its types are generated from JSDoc. Determine how a generic type parameter can be represented while preserving the default any behavior, then verify that the generated declaration exposes the requested getValue and equals signatures without breaking compatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.