Proposal static type constraints features

Jordan Harband ljharb at gmail.com
Mon Jun 4 05:31:58 UTC 2018


There's the separate issue that "void" in no way connotes types, so that
word wouldn't likely be acceptable, because it has no relevant meaning.

On Sun, Jun 3, 2018 at 10:27 PM, YU HengChun <achun.shx at qq.com> wrote:

> You mean this...
>
> The original:
>
> ```js
> function f(x) {
>   return typeof x !== 'string' || typeof x === 'undefined';
> }
> ```
>
> The proposal:
>
> ```js
> function f(x = void String) {
>   void Boolean; // The complete code should be like this
>   return typeof x !== 'string' || typeof x === 'undefined';
> }
> ```
>
> Thank you, you actually provided an example to prove that the proposal is
> conflict-free.
>
> Test code is casually written, the results of these two versions will be
> consistent.
>
>
> 我得谢谢你的关注(真的, 这样才可以有更多的验证).
> 你刚好提供了一个例子证明我的提案是无冲突的.
> 随便写测试代码吧, 这两个版本的结果完全一致.
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180603/19684130/attachment-0001.html>


More information about the es-discuss mailing list