-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] [TypeScript] prefer interface to conditional types #250
Comments
Let me take a look into it tomorrow. Also mentioning @ankeetmaini in case you have time to take a look and you want to participate :) |
This looks really cool! I think we can remove the generic parameter |
It's not just you, see #279. |
I had a call with @andrewbranch about types in We talked about how we can define Types in a way that consumers could extend them with custom events, in order to address #277. What we would like to allow is something like this: declare "@octokit/webhooks" {
interface Events {
"my_custom_event": MyCustomEventPayload
}
} I think that is very similar to what @shigma suggests, and we would not only simplify our TypeDefinitions and make them more efficient, but also allow for custom types. @andrewbranch - did I get this right? @ankeetmaini has a work inprogress PR here: #258 |
I gave this some more thought, and I think I'd actually prefer what The reason for that is that it is possible that these type definitions will move to other packages in future, e.g. an declare namespace Octokit {
export interface Events {
"my_custom_event": MyCustomEventPayload
}
} |
🎉 This issue has been resolved in version 7.12.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Is this still a thing to cover @gr2m @ankeetmaini ? Would it solve #277 ? (just catching up with PR's, is not clear to me if we have this sorted out 😇 ) |
In Typescript interfaces merging is allowed. I'll have to test how it'll pick up as the interfaces would be in different files. We might need to wrap the interface in a module. |
Maybe we can try a dummy project or draft an example on Typescript Playground? From here I would be happy to draft a PR or help (I'm not that into TS yet) |
Yes. I want to give it more thought, a global |
Sounds good to me. Do you want me to create a new issue for this so we keep track on it? :) |
that'd be great thank you! |
This will not only help reduce dist size but also optimize type check performance.
The text was updated successfully, but these errors were encountered: