Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve type aliases on implement interface #36761

Open
mjbvz opened this issue Feb 12, 2020 · 0 comments
Open

Preserve type aliases on implement interface #36761

mjbvz opened this issue Feb 12, 2020 · 0 comments
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 12, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants