Closed Riim closed 8 years ago
Input:
/** * @typesign (el: HTMLElement, name: string) -> boolean; */ let hasClass; if (document.documentElement.classList) { hasClass = (el, name) => { return el.classList.contains(name); }; } else { let reNotWhite = /\S+/g; hasClass = (el, name) => { return (el.className.match(reNotWhite) || []).indexOf(name) != -1; }; } module.exports = hasClass;
Output:
"use strict"; function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } /** * @typesign (el: HTMLElement, name: string) -> boolean; */ var hasClass = undefined; if (document.documentElement.classList) { hasClass = function (el, name) { return el.classList.contains(name); }; } else { (function () { var reNotWhite = /\S+/g; hasClass = function (el, name) { return (el.className.match(reNotWhite) || []).indexOf(name) != -1; }; })(); } module.exports = hasClass; if (!(module.exports == null)) { throw new TypeError("Value of \"module.exports\" violates contract, expected void got " + (module.exports === null ? 'null' : _typeof(module.exports) === 'object' && module.exports.constructor ? module.exports.constructor.name || '[Unknown Object]' : _typeof(module.exports))); }
Added check will never pass.
@Riim can you confirm that you're using 3.4.6 ? I really thought I'd fixed this.
By the way, you can work around this in the meantime using a pragma
Yes: "babel-plugin-typecheck": "^3.4.6",
"babel-plugin-typecheck": "^3.4.6",
fixed in #88
Input:
Output:
Added check will never pass.