z-pattern-matching/z

does not work with typescript

Open

#35 创建于 2017年12月1日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)JavaScript (1,714 star) (78 fork)batch import
bughelp wanted

描述

Strange but when I use some of the snippets with typescript, it always returns the result of the first param. For example

import {matches} from 'z';

const person = { name: 'Maria' }
matches(person)(
  (x = { name: 'John' }) => console.log('John you are not welcome!'),
  (x)                    => console.log(`Hey ${x.name}, you are welcome!`)
)

returns John you are not welcome.

贡献者指南