代码之家  ›  专栏  ›  技术社区  ›  RainingChain

Vscode Typescript:显示类型的别名而不是其定义

  •  0
  • RainingChain  · 技术社区  · 6 年前

    我有以下代码

    type Opaque<T,U> = T & {_:U};
    type EKey = Opaque<number,'EKey'>;
    type AKey = Opaque<EKey,'AKey'>;
    type PKey = Opaque<AKey,'PKey'>;
    
    let a = <PKey>1;
    let b:EKey = a;
    

    a PKey 而不是 Opaque<Opaque<Opaque<"EKey">,"AKey">,"PKey"> .

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  0
  •   RainingChain    6 年前

    您可以通过编写自己的typescript语言服务器插件并覆盖 getQuickInfoAtPosition .

    https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin