So now for every type annotation, someone has to add `&& undefined`? That seems like a lot of confusing boilerplate to have to add.
On Sun, Jun 3, 2018 at 10:39 PM, YU HengChun <[email protected]> wrote: > 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'; > } > ``` > > 这很容易解决, 换个单词就行. 但是代码会更长. > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

