V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
zhengfan2016
V2EX  ›  程序员

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

  •  
  •   zhengfan2016 · Feb 12, 2025 · 2231 views
    This topic created in 452 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
        2
    justdoit123  
       Feb 12, 2025   ❤️ 1
    类型体操的麻烦之处。

    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
        3
    zhengfan2016  
    OP
       Feb 12, 2025
    @Razio 感谢,一直就想找这样的插件
    yusf
        5
    yusf  
       Feb 13, 2025
    继承的代码看着头大
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2943 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 10:08 · PVG 18:08 · LAX 03:08 · JFK 06:08
    ♥ Do have faith in what you're doing.