googleapis / googleapis/google-api-nodejs-client
Improve 'historyTypes' typing
- Vorherrschende Sprache
- TypeScript
- Sterne
- 12.2k
- Forks
- 2k
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 24
Beschreibung
It seems that the `historyTypes` property on the [Params$Resource$Users$History$List](https://github.com/googleapis/google-api-nodejs-client/blob/main/src/apis/gmail/v1.ts#LL2583C3-L2583C54) interface could be improved by giving users a list of valid values. In its current implementation, any list of strings is valid.
My proposed solution would look something like [this](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAtgUwhAhgcwQQQCbYdmAXhgCJFl0td8SYAoUSWc1DAEQQBsEp8jSWlDt17YSDcNBicUAIy448BYiRnzOimhKbS5XAEoI4IAG58Vag0dNa6dKAE8ADghgAJAJbQQAJwcAVZyR+TB8fFAcAHjoYWJhHFxAAM3gkViolGAAfeKDk1Ip2Lh4+HISEfMsNagIyvJSqw2MzbDoAPgBuO0YpAAsvKF8AoIgALncBocCXCH4AbVU9aqUSAF07OiA):
```ts
const messageAdded = "messageAdded"
const messageDeleted = "messageDeleted"
const labelAdded = "labelAdded"
const labelRemoved = "labelRemoved"
type HistoryTypes = Array<
typeof messageAdded | typeof messageDeleted | typeof labelAdded | typeof labelRemoved
>;
const historyTypes: HistoryTypes = ["labelAdded"]
```
Beitragsleitfaden
Rechercherichtung
Start in src/apis/gmail/v1.ts at the Params$Resource$Users$History$List interface and inspect the current historyTypes declaration. Compare it with the four valid values listed in the issue, then verify that the resulting type accepts those values and rejects arbitrary strings.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- nodejs, typescript
- Bereich
- api
- Issue-Typ
- Feature
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100