Branded Typeã«ã¤ãã¦ã¯ãããããããªã¨ããã§è§¦ãããã¦ãããããããããæ¸ããªãã¦ãããããªãã¨ããæ°æã¡ãããã¤ã¤ãã§ãããã£ããé ã®æ´çããããããæ¥æã®èªåç¨ã«ã¾ã¨ãã¦ãããããã¯ãã£ã¦ãããããã¨ããæ°æã¡ã«ãªã£ãã®ã§ã¡ã¢ãæ®ãã¦ãããããã¨Zodã®.brandã ããããã㨠次ã®2ã¤ã®åã«å¯¾ããå¤ãééãã¦æ¸¡ããã¨ãã«ãTypeScriptã®åæ¤æ»ã§ã¨ã©ã¼ã«ãªã£ã¦ã»ããã type UserId = number; type BookId = number; TSã®åã·ã¹ãã ã¯Structural Subtypingãæ¡ç¨ãã¦ããã®ã§ãæ§é ãåãã ã£ããé¨ååã¨ãã¦æ±ããããã ãããâãããªé¢¨ã«UserIdãå¼æ°ã§åãåãé¢æ°ã«BookIdã®å¤ã渡ãã¦ãã¨ã©ã¼ã«ãªããªããã©ã¡ããåãnumberåã ããã const getUser = (id: UserId) =
{{#tags}}- {{label}}
{{/tags}}