microsoft / microsoft/TypeScript

Preserve type aliases on implement interface

オープン
#36,761 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Experience Enhancement Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

From https://github.com/microsoft/vscode/issues/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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

再現された IdToUrlMapper の例を使用して、TypeScript language-service の「implement interface」クイックフィックスから始めます。生成されたメソッドシグネチャを期待される出力と比較し、UUID や UrlString などの型エイリアスが string に縮小されず保持されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。