laters

如何从对象的值提取到一个新的类型别名

  •  
  •   laters · Apr 12, 2023 · 1526 views
    This topic created in 1163 days ago, the information mentioned may be changed or developed.

    How to extract a new type alias from an object's value

    const test = {
    'a': ['music','bbq','shopping'],
    'b': ['move','work']
    };
    

    如何从 test 对象中得到

    type Types = 'music' | 'bbq' | 'shopping' | 'move' | 'work'
    
    1 replies    2023-05-08 15:14:39 +08:00
    zy0829
        1
    zy0829  
       May 8, 2023
    type Types<T> = T[keyof T]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2690 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 03:53 · PVG 11:53 · LAX 20:53 · JFK 23:53
    ♥ Do have faith in what you're doing.