Project Management Automation: Add TypeScript type-checking#20850
Project Management Automation: Add TypeScript type-checking#20850
Conversation
|
Size Change: +1.62 kB (0%) Total Size: 857 kB
ℹ️ View Unchanged
|
| "@babel/runtime-corejs3": "7.8.3", | ||
| "@babel/traverse": "7.8.3", | ||
| "@octokit/rest": "16.26.0", | ||
| "@octokit/webhooks": "7.1.0", |
There was a problem hiding this comment.
Out of curiosity, do we include this dev dependency only for type checking?
There was a problem hiding this comment.
Yes, that's right.
Related to this guideline:
For packages which do not distribute their own TypeScript types, you are welcomed to install and use the DefinitelyTyped community-maintained types definitions, if one exists.
Though in this case, it's a bit awkward in that it's neither from DefinitelyTyped, nor actually the type of the packages we are using (@octokit/rest, @actions/github) or a dependent of those.
The reason for this is that the actual correct typings are neither very useful nor accurate:
https://github.com/actions/toolkit/blob/12f3011/packages/github/src/interfaces.ts#L15-L39
See also: actions/toolkit#147
It's still a bit questionable whether we should do this, since technically there's not a strong guarantee that the payload matches the type from @octokit/webhooks, aside from the fact that they both purport to represent the structure of a webhook payload.
gziolo
left a comment
There was a problem hiding this comment.
Nice work here. This PR and your article https://andrewduthie.com/2020/03/15/typescript-types-for-productivity/, they made me think that we should add type definitions to all existing developer-oriented packages.
#18942 😉 |
Part of: #18838
This pull request seeks to enable type-checking for the Project Management Automation package, and improves existing types. GitHub's core modules provide types by default, which we can use to verify types of the implementation of our automation tasks.
Testing Instructions:
Ensure type-checking passes:
cc @sirreal