Skip to content

Interop Gen: Support Overloading #388

Open
@nikeokoronkwo

Description

@nikeokoronkwo

This issue is to add support for overloading declarations.

This involves supporting the overloading of interfaces, classes, functions etc:

// assuming the given interfaces are specified
function clone(animal: Dog): Dog;
function clone(animal: Cat): Cat;
function clone(animal: Sheep): Sheep;
function clone(animal: Animal): Animal;

// interface overloading
interface Overloader<T extends Overloadee> {
  /* some decls */
}
interface Overloader<T extends Overloadee> {
  /* some other decls */
  getOverloadee(): Overloadee
}

This issue would involve working with declarations of the same name both during transformation and generation. Referrable declarations such as namespaces, interfaces, etc are merged together, while functions are overloaded as normal with multiple declarations.

In the case of an interface and namespace (i.e Deno's version of rm in node:fs), the namespace is named initially and the functions separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions