Proposal static type constraints features
Isiah Meadows
isiahmeadows at gmail.com
Sun Jun 3 16:21:37 UTC 2018
How this this syntax more useful than one derived from TS/Flow, like `x: Foo`?
-----
Isiah Meadows
me at isiahmeadows.com
www.isiahmeadows.com
On Sun, Jun 3, 2018 at 11:48 AM, YU HengChun <achun.shx at qq.com> wrote:
> Update
>
>
> ## Compatibility
>
> For safety, it may be a good idea to use it with default values.
>
> ```js
> let
> isUndefined = void Number,
> // Static type constraint does not take effect
> isNumberUndefined = void(Number)|undefined;
> // Static type constraint take effect
>
> ```
>
> ## Pending
>
> I'm not sure if it is necessary to support multiple levels of nesting
>
> ```js
> class ConfigType {
> constructor() {
> void {
> version: Number,
> encodeNames: Boolean,
> lines: [String],
> filename: String,
> linker: undefined | { // Need support?
> statics: { [String]: Number },
> }
> };
> }
> }
> ```
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
More information about the es-discuss
mailing list