googleapis / googleapis/google-api-nodejs-client

Improve 'historyTypes' typing

Open
#3,178 1 comment 0 reactions 0 assignees View on GitHub
api: gmail priority: p3 type: feature request
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

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"]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.