We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-application describes possible Type Application for Object: Object<string, someType>. It's easy to implement assert generation for this case as
Object<string, someType>
/** * @param {Object<string, number>} x */
=>
Object.values(x).every(function (item) { return typeof item === 'number'; });
AFAIK there is no need to generate assertion for first type (for object keys), as it will always be string.
string
If it looks good, then I'll make a PR.
The text was updated successfully, but these errors were encountered:
It looks good to me.
But, Object.values() is not parts of current ECMAScript yet. (It will be included in ECMAScript 2017. Some enviroment is not implemented yet.)
It is better that use Object.keys(x) instead of Object.values(x), I think.
Object.keys(x)
Object.values(x)
Object.keys(x).every(function (key) { return typeof x[key] === 'number'; });
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-application describes possible Type Application for Object:
Object<string, someType>
. It's easy to implement assert generation for this case as=>
AFAIK there is no need to generate assertion for first type (for object keys), as it will always be
string
.If it looks good, then I'll make a PR.
The text was updated successfully, but these errors were encountered: