Commit 1165b48f authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

Update Mojo JS externs to use @record instead of @typedef.

This ensures that adding fields to Mojo structs which are not defined
within the struct's definition causes a compiler error.

Fixed: 1031385
Change-Id: I56cc509a192be882227763f47cec05ef6a8c5ad5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2006413
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#742653}
parent 4dbcdad0
......@@ -41,17 +41,14 @@ mojo.internal.Struct(
{% if generate_closure_exports -%}
goog.provide('{{module.namespace}}.{{struct.name}}');
{% if struct.packed.packed_fields %}
/**
* @typedef { {
/** @record */
{{module.namespace}}.{{struct.name}} = class {
constructor() {
{%- for packed_field in struct.packed.packed_fields %}
* {{packed_field.field.name}}: {{packed_field.field.kind|lite_closure_field_type}},
/** @type { {{packed_field.field.kind|lite_closure_field_type}} } */
this.{{packed_field.field.name}};
{%- endfor %}
* } }
*/
{% else %}
/** @typedef {Object} */
{% endif %}
{{module.namespace}}.{{struct.name}};
}
};
{%- endif %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment