Description
Description
To start defining and discussing the foundations of Octokit namespace
.
Original messages:
I gave this some more thought, and I think I'd actually prefer what
express
is doing by defining a global namespace, see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/express-serve-static-core/index.d.ts#L17-L25The reason for that is that it is possible that these type definitions will move to other packages in future, e.g. an
@octokit/events
package or@octokit/types
. My understanding is that this would require changes to thedeclare "@octokit/webhooks"
blocks, while the global namespace approach would always work
declare namespace Octokit {
export interface Events {
"my_custom_event": MyCustomEventPayload
}
}
Originally posted by @gr2m in #250 (comment)
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.
_Originally posted by @ankeetmaini in #250 (comment)
I want to give it more thought, a global Octokit namespace would affect all Octokit libraries. We can start experimenting now, I just don't want to rush ahead and build it, to avoid disruptive changes once we put it all together with the types from the REST API endpoints, etc
_Originally posted by @gr2m in #250 (comment)