Proposal static type constraints features

YU HengChun achun.shx at qq.com
Mon Jun 4 05:39:29 UTC 2018


This is easy to solve, we change the word. But the code will be longer.

The original:

```js
function f(x) {
  return typeof x !== 'string' || typeof x === 'undefined'; 
}
```

The proposal: typeof version

```js
function f(x = typeof(String) && undefined ) { // Attention can not be omitted: && undefined
  void typeof(Boolean); // or only: typeof(Boolean);
  return typeof x !== 'string' || typeof x === 'undefined'; 
}
```

这很容易解决, 换个单词就行. 但是代码会更长.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180604/76f86736/attachment.html>


More information about the es-discuss mailing list