Skip to content

Interop Gen: Add Support for Merging Interface Types to already built-in Dart JS Interop Types as Extensions #430

@nikeokoronkwo

Description

@nikeokoronkwo

Some interfaces established in dart:js_interop may be extended by a library via an interface, such as how the ES specs extend each other, and already built in interfaces that dart:js_interop may have.

// from: https://github.com/microsoft/TypeScript/blob/main/src/lib/es2015.core.d.ts
interface Array<T> {
    find<S extends T>(predicate: (value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
    find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;

    findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;

    fill(value: T, start?: number, end?: number): this;
    copyWithin(target: number, start: number, end?: number): this;

    toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
}

Since Dart's JS Interop has support for external extensions to such types, we can convert these into extensions on types in dart:js_interop types during overload merging (#388)

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