Either treat Value as a top type, or remove Color from its member types
Open
Nobody has claimed this yet.
cross-platform :tv:
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
According to this logic, together with Array subtyping, Value is effectively the top type.
Since we'll likely soon be adding an array-constructing expression like [make-array, item1, item2, ...], it will be possible for arrays to contain colors. Given that, we should:
- Just treat
Valueas a truetoptype (so thatcheckSubtype(ValueType, t)always succeeds) - Remove
Colorfrom the member types ofValue. Doing this would also imply:- Change the base
Arraytype to meanArray<Any>rather thanArray<Value> - Change the
ValuememberArraytoArray<Value>
- Change the base
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
Start with src/style-spec/function/types.js lines 84-90 and trace the existing Value, Color, Array, and checkSubtype logic. Compare the two proposed type-system options, then verify that the chosen semantics consistently handle array subtyping and Value's member types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100