• 请不要在回答技术问题时复制粘贴 AI 生成的内容
zhengfan2016
V2EX  ›  程序员

大佬们,前端 ts 有没有办法比较方便的预览最终的 interface 结构

  •  
  •   zhengfan2016 · Feb 12, 2025 · 2736 views
    This topic created in 629 days ago, the information mentioned may be changed or developed.

    如题,有如下的结构,每个 interface 都继承上一个 interface ,interface 分散在多个文件中,有没有办法预览最终的 interface 结构,我试着用 vscode hover ,只会显示interface Z,如果想知道其他 interface 的结构,需要层层跳转

    interface Z extends Y {
      a: string
    }
    
    interface Y extends X {
      ...
    }
    
    ..........
    
    interface B extends A {
      ...
    }
    interface A {
      ...
    }
    
    const handleXXX = (props: Z) =>{
      // handleXXX
    }
    
    6 replies  •  2025-02-13 10:29:29 +08:00
    justdoit123
    justdoit123
    Feb 12, 2025❤️1
    2
    类型体操的麻烦之处。

    https://www.reddit.com/r/typescript/comments/15436n1/how_to_show_the_full_final_type_structure_for_a/

    这篇问题看下来,感觉那个

    ```
    type Prettify<T> = {
    [K in keyof T]: T[K];
    } & {};
    ```
    zhengfan2016
    zhengfan2016
    OP
    Feb 12, 2025
    3
    @Razio 感谢,一直就想找这样的插件
    yusf
    yusf
    Feb 13, 2025
    5
    继承的代码看着头大
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4248 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 01:07 · PVG 09:07 · LAX 17:07 · JFK 20:07
    ♥ Do have faith in what you're doing.