laters

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

  •  
  •   laters · Apr 12, 2023 · 1776 views
    This topic created in 1304 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
    zy0829
    May 8, 2023
    1
    type Types<T> = T[keyof T]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1855 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:16 · PVG 17:16 · LAX 01:16 · JFK 04:16
    ♥ Do have faith in what you're doing.