google/closure-compiler-js

NTI vs OTI inconsistency in @record missed property handling

dmitryxcom opened this issue · 1 comments

To repro, compile this with OTI and NTI:

/** @record */
class ChromeWebPushMessage {
  constructor() {
    /** @export {string} */
    this.deviceId;

    /** @export {number} */
    this.timestampSec;

    /** @export {number} */
    this.displayCap;
  }
}

/**
 * @param {!ChromeWebPushMessage} data The payload extracted from the push event.
 * @param {string} url The URL to navigate to if the user clicks the
 *     notification.
 */
function displayNotificationPayload(data, url) {
  if (data.xxy) { // <---------- THIS THING, IS IT WAI NOT TO REPORT MISSING PROPERTY?
    const /** string */ x = data.xxy;
  }
}

OTI reports missing property (expected), while NTI does not.

If this is an issue with Closure Compiler itself (rather than the JS version specifically), try reporting the issue on the main repo: https://github.com/google/closure-compiler