Proposal: Static Typing
Jordan Harband
ljharb at gmail.com
Fri Apr 5 20:56:07 UTC 2019
`const` means it can't be reassigned, but a non-frozen value can still have
its properties changed or its [[Prototype]] changed (including Promise,
which could have its `.then` method changed), which would change the type.
On Fri, Apr 5, 2019 at 11:36 AM guest271314 <guest271314 at gmail.com> wrote:
> Two possible solutions to the requirement of not being able to change a
> "type" both include utilizing `const`.
>
> 1. Using `Object.freeze()`
>
> `const x = Object.freez([1,2,3])`
>
> 2. Using `Promise.resolve()`
>
> `const x = Promise.resolve([1,2,3])`
>
> neither of which can be deleted or changed within the current scope.
> _______________________________________________
> 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/20190405/e61b3c16/attachment.html>
More information about the es-discuss
mailing list