Skip to content

Commit

Permalink
rollback "Use @interface instead of @record for chrome event types"
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Appears to break google projects

*** Original change description ***

Use @interface instead of @record for chrome event types

It turns out the type system currently handles @interface better than @record,
leading to smaller output code. @record really isn't needed for chrome event
types since there's no need to have an object literal implicitly treated as an
event type.

Related to #2527

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174070203
  • Loading branch information
tap-prod authored and brad4d committed Nov 1, 2017
1 parent f72655f commit 28408f8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
18 changes: 9 additions & 9 deletions contrib/externs/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Port.prototype.disconnect = function() {};
* LISTENER must be a function type that returns void.
*
* @see https://developer.chrome.com/extensions/events.html
* @interface
* @record
* @template LISTENER
*/
function ChromeBaseEvent() {}
Expand Down Expand Up @@ -111,7 +111,7 @@ ChromeBaseEvent.prototype.hasListeners = function() {};
* information about the parameters that will actually be supplied to the
* listener and should be updated to use a more specific event type.
* @see https://developer.chrome.com/extensions/events.html
* @interface
* @record
* @extends {ChromeBaseEvent<!Function>}
*/
function ChromeEvent() {}
Expand All @@ -121,55 +121,55 @@ function ChromeEvent() {}
* Event whose listeners take no parameters.
*
* @see https://developer.chrome.com/extensions/events.html
* @interface
* @record
* @extends {ChromeBaseEvent<function()>}
*/
function ChromeVoidEvent() {}


/**
* Event whose listeners take a string parameter.
* @interface
* @record
* @extends {ChromeBaseEvent<function(string)>}
*/
function ChromeStringEvent() {}


/**
* Event whose listeners take a boolean parameter.
* @interface
* @record
* @extends {ChromeBaseEvent<function(boolean)>}
*/
function ChromeBooleanEvent() {}


/**
* Event whose listeners take a number parameter.
* @interface
* @record
* @extends {ChromeBaseEvent<function(number)>}
*/
function ChromeNumberEvent() {}


/**
* Event whose listeners take an Object parameter.
* @interface
* @record
* @extends {ChromeBaseEvent<function(!Object)>}
*/
function ChromeObjectEvent() {}


/**
* Event whose listeners take a string array parameter.
* @interface
* @record
* @extends {ChromeBaseEvent<function(!Array<string>)>}
*/
function ChromeStringArrayEvent() {}


/**
* Event whose listeners take two strings as parameters.
* @interface
* @record
* @extends {ChromeBaseEvent<function(string, string)>}
*/
function ChromeStringStringEvent() {}
Expand Down

0 comments on commit 28408f8

Please sign in to comment.