Skip to content

Preserve type aliases on implement interface #36761

Open
@mjbvz

Description

@mjbvz

From microsoft/vscode#90061

TypeScript Version: 3.8.1-rc

Search Terms:

  • quick fix
  • implement interface

Repo

export type UrlString = string;
export type UUID = string;

export interface I_IdToUrlMapper {
	mapIdToUrl(id: UUID): UrlString
	mapUrlToId(url: UrlString): UUID
}

export class IdToUrlMapper implements I_IdToUrlMapper {

}

Run implement interface on IdToUrlMapper

Expected behavior:
Type aliases are preserved

export class IdToUrlMapper implements I_IdToUrlMapper {
    mapIdToUrl(id: UUID): UrlString {
        throw new Error("Method not implemented.");
    }
    mapUrlToId(url: UrlString): UUID {
        throw new Error("Method not implemented.");
    }
}

Actual behavior:
Both methods use string:

export class IdToUrlMapper implements I_IdToUrlMapper {
    mapIdToUrl(id: string): string {
        throw new Error("Method not implemented.");
    }
    mapUrlToId(url: string): string {
        throw new Error("Method not implemented.");
    }
}

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions