Proposal: Symbol Linked to `typeof`

ViliusCreator viliuskubilius416 at gmail.com
Tue Jan 15 19:35:08 UTC 2019


I could definitely see usage of this when using custom Constructors. But this could confuse current code of JS:

```js
function A(B, C) {
    if(typeof B === ‘string’) // ...
}
A({[Symbol.typeof]: ‘string’})
```

This would make new code to use not only `typeof B === ‘String’`, but also `B instanceof ‘String’`.


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190115/71275886/attachment.html>


More information about the es-discuss mailing list