ericelliott / ericelliott/rtype
Defining dynamic but consistent types
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
The **FooByUser** object is a simple structure representing the amount of foo performed by each user, setting each property's key & value to the username & recorded foo respectively.
The collection of keys composing the object may vary between objects representing different periods. For example if new user3 records foo in April then the March and April objects will differ in keys : `{user1: 100, user2: 3}` vs `{user1: 87, user2: 5, user3: 30 }`.
From a code documentation perspective I want to define FooByUser as having a set of property keys of known origin & type (if such a word can be used), but which cannot be predetermined for each particular instance.
Could we have a syntax something like the following?
```
interface FooByUser {
*: Number
}
def username {
desc: "The username of a user",
source: {type: "database", location: "users.id"}
}
```
Where the <> demonstrate that that we are using a `def` rather than a static key and the \* represents that there may be more than one of these keys.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.