Proposal static type constraints features
YU HengChun
achun.shx at qq.com
Sun Jun 3 15:48:06 UTC 2018
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 },
}
};
}
}
```
More information about the es-discuss
mailing list