両è ã®éã ã¨ãã£ã¿ã§ããã¼ããã¨ãããã 1 ã¨ããåã表示ãããä¸è¦åããã¨ããã¦ããããã«æããããããã¾ããããããããããã¯æ確ã«éãåãæã¡ã¾ãã ãã®åã«ããã¹ã¦ã®å¤æ°ã¯ããã®å¤æ°ã®åã¨ã¯å¥ã«ãType Narrowingã¨ããä»çµã¿ã«ãã£ã¦ä¸æçã«å¥ã®åã¨ãã¦åãæ±ãæ©è½ãããã¾ãã ããããã仮㫠global type 㨠narrowed type ã¨å¼ã¶ãã¨ã«ãã¾ãã ããã¨ãconst n: 1 = 1 㯠(global type, narrowed type) = (1, 1) ã§ãããconst n = 1 㯠(global type, narrowed type) = (number, 1) ã§ããããã¯ä»¥ä¸ã®ãããªã³ã¼ãã§ç¢ºèªãã§ãã¾ãã const n: 1 = 1; const getN = () => n; // inferred as () =
{{#tags}}- {{label}}
{{/tags}}