Skip to content

[discussion]: Put foundations on Octokit namespace #308

Open
@oscard0m

Description

@oscard0m

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-L25

The 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 the declare "@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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: MaintenanceAny dependency, housekeeping, and clean up Issue or PRprojectGoes beyond a single bug fix or new feature. Help welcome by existing contributors.typescriptRelevant to TypeScript users only

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions