ä¼ç¤¾ã§NeverThrowã¨ããã©ã¤ãã©ãªã使ã£ã¦ãã¾ãã ã¨ã¦ã便å©ãªã®ã§ãã¨ã¦ã便å©ã ããã¨ããè¨äºãæ¸ãã¾ãã NeverThrowã¨ã¯ï¼ NeverThrowã¯ãTypeScriptã§ãResultåããå®ç¾ã§ããã©ã¤ãã©ãªã§ãã Resultåã¨ã¯ï¼ Resultåã¯ãé¢æ°ã®ä¸ã§ã¨ã©ã¼ãthrowãã代ããã«ãã¨ã©ã¼ãæ»ãå¤ã¨ãã¦è¿ãããã«ããã°ãããããï¼ãªä»çµã¿ã®ãã¨ãããã¾ãã ãã£ã¨åã¿ç ãã¦èª¬æãã¾ãã ãã¨ãã°ã50%ã®ç¢ºçã§è¶³ãç®ãã¦ããããã©ã50ï¼ ã®ç¢ºçã§ð©ãthrowãããã¨ããé¢æ°ãããã¨ãã¾ãã ã³ã¼ãã§è¡¨ãã¨ðã«ãªãã¾ãã function add(a: number, b: number) { if (Math.random() >= 0.5) { throw new Error('ð©'); } return a + b; }
{{#tags}}- {{label}}
{{/tags}}