rokucommunity / rokucommunity/brighterscript
Add support for typed associative array values
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 68
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 39
Description
This is likely too close to Generics support, but we could use some way to type the values of AAs without being concerned for its keys.
Typescript does it with mapped types:
type OnlyBoolsAndHorses = {
[key: string]: boolean | Horse;
};
const conforms: OnlyBoolsAndHorses = {
del: true,
rodney: false,
};
Originally, given that our AAs support nothing other than strings, I was going to suggest adding some sort of Map<T> syntax. However, I started thinking about how we could use string-based enums for keys as well. So I'm wondering how we could make it neater. Perhaps the same syntax as Typescript could work?
Contributor guide
No contributing guide indexed for this repository
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
No files or tests are named. Start by reviewing the existing Generics support and associative-array type handling, then compare the proposed TypeScript-style syntax with the language's current type syntax. Done means agreeing on syntax and semantics for typed values and implementing the resulting behavior with coverage for the supported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100