file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
crates/swc/tests/tsc-references/typeFromPropertyAssignment9.1.normal.js
JavaScript
//// [a.js] var my = my || {}; /** @param {number} n */ my.method = function(n) { return n + 1; }; my.number = 1; my.object = {}; my.predicate = my.predicate || {}; my.predicate.query = function() { var me = this; me.property = false; }; var q = new my.predicate.query(); my.predicate.query.another = functio...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignment9.2.minified.js
JavaScript
//// [a.js] var my = my || {}; my.method = function(n) { return n + 1; }, my.number = 1, my.object = {}, my.predicate = my.predicate || {}, my.predicate.query = function() { this.property = !1; }, new my.predicate.query(), my.predicate.query.another = function() { return 1; }, my.predicate.query.result = 'n...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignment9_1.1.normal.js
JavaScript
//// [a.js] var my = my ?? {}; /** @param {number} n */ my.method = function(n) { return n + 1; }; my.number = 1; my.object = {}; my.predicate = my.predicate ?? {}; my.predicate.query = function() { var me = this; me.property = false; }; var q = new my.predicate.query(); my.predicate.query.another = functio...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignment9_1.2.minified.js
JavaScript
//// [a.js] var my = my ?? {}; my.method = function(n) { return n + 1; }, my.number = 1, my.object = {}, my.predicate = my.predicate ?? {}, my.predicate.query = function() { this.property = !1; }, new my.predicate.query(), my.predicate.query.another = function() { return 1; }, my.predicate.query.result = 'n...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.1.normal.js
JavaScript
//// [index.js] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; First.Item = function I() { "use strict"; _class_call_check(this, I); }; Common.Object = /*#__PURE_...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.2.minified.js
JavaScript
//// [index.js] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; First.Item = function I() { _class_call_check(this, I); }, Common.Object = /*#__PURE__*/ function(_Firs...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignmentWithExport.1.normal.js
JavaScript
//// [a.js] // this is a javascript file... export var Adapter = {}; Adapter.prop = {}; // comment this out, and it works Adapter.asyncMethod = function() {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPropertyAssignmentWithExport.2.minified.js
JavaScript
//// [a.js] export var Adapter = {}; Adapter.prop = {}, Adapter.asyncMethod = function() {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment.1.normal.js
JavaScript
//// [a.js] // all references to _map, set, get, addon should be ok /** @constructor */ var Multimap = function Multimap() { this._map = {}; this._map; this.set; this.get; this.addon; }; Multimap.prototype = { set: function set() { this._map; this.set; this.get; t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment.2.minified.js
JavaScript
//// [a.js] var Multimap = function() { this._map = {}, this._map, this.set, this.get, this.addon; }; Multimap.prototype = { set: function() { this._map, this.set, this.get, this.addon; }, get: function() { this._map, this.set, this.get, this.addon; } }, Multimap.prototype.addon = fu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment2.1.normal.js
JavaScript
//// [a.js] // non top-level: // all references to _map, set, get, addon should be ok (function container() { /** @constructor */ var Multimap = function Multimap() { this._map = {}; this._map; this.set; this.get; this.addon; }; Multimap.prototype = { set: fun...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment2.2.minified.js
JavaScript
//// [a.js]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment3.1.normal.js
JavaScript
//// [bug26885.js] function Multimap3() { this._map = {}; } Multimap3.prototype = { /** * @param {string} key * @returns {number} the value ok */ get: function get(key) { return this._map[key + '']; } }; /** @type {Multimap3} */ var map = new Multimap3(); var n = map.get('hi');
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment3.2.minified.js
JavaScript
//// [bug26885.js] function Multimap3() { this._map = {}; } Multimap3.prototype = { get: function(key) { return this._map[key + '']; } }, new Multimap3().get('hi');
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment4.1.normal.js
JavaScript
//// [a.js] function Multimap4() { this._map = {}; } Multimap4["prototype"] = { /** * @param {string} key * @returns {number} the value ok */ get: function get(key) { return this._map[key + '']; } }; Multimap4["prototype"]["add-on"] = function() {}; Multimap4["prototype"]["addon"] = functio...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeFromPrototypeAssignment4.2.minified.js
JavaScript
//// [a.js] function Multimap4() { this._map = {}; } Multimap4.prototype = { get: function(key) { return this._map[key + '']; } }, Multimap4.prototype["add-on"] = function() {}, Multimap4.prototype.addon = function() {}, Multimap4.prototype.__underscores__ = function() {}; var map4 = new Multimap4()...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardEnums.1.normal.js
JavaScript
//// [typeGuardEnums.ts] var E = /*#__PURE__*/ function(E) { return E; }(E || {}); var V = /*#__PURE__*/ function(V) { return V; }(V || {}); var x; if (typeof x === "number") { x; // number|E|V } else { x; // string } if (typeof x !== "number") { x; // string } else { x; // number|E|V }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardEnums.2.minified.js
JavaScript
//// [typeGuardEnums.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunction.1.normal.js
JavaScript
//// [typeGuardFunction.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var A = function A() { "use strict"; _class_call_check(this, A); }; var B = function B(...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunction.2.minified.js
JavaScript
//// [typeGuardFunction.ts] var a, subType, union, union2; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; isC(a) && a.propC, isA(subType) && subType.propC, isA(union) && ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunctionGenerics.1.normal.js
JavaScript
//// [typeGuardFunctionGenerics.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var A = function A() { "use strict"; _class_call_check(this, A); }; var B = fun...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunctionGenerics.2.minified.js
JavaScript
//// [typeGuardFunctionGenerics.ts] var a; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; funA(isB), funB(retC, a) && a.propC, funC(isB), funD(isC, a) && a.propC, funE(is...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunctionOfFormThis.1.normal.js
JavaScript
//// [typeGuardFunctionOfFormThis.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var RoyalGuard = /*#__...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunctionOfFormThis.2.minified.js
JavaScript
//// [typeGuardFunctionOfFormThis.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var b, crate, RoyalGua...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunctionOfFormThisErrors.1.normal.js
JavaScript
//// [typeGuardFunctionOfFormThisErrors.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var RoyalGuard =...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardFunctionOfFormThisErrors.2.minified.js
JavaScript
//// [typeGuardFunctionOfFormThisErrors.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var c, RoyalGuar...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardInClass.1.normal.js
JavaScript
//// [typeGuardInClass.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x; if (typeof x === "string") { var n = function n() { "use strict"; _class_call_check(this, n); var y = x; }; } else { var m = function m() { "use strict"; _clas...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardInClass.2.minified.js
JavaScript
//// [typeGuardInClass.ts] import "@swc/helpers/_/_class_call_check";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardIntersectionTypes.1.normal.js
JavaScript
//// [typeGuardIntersectionTypes.ts] function f1(obj) { if (isX(obj) || isY(obj) || isZ(obj)) { obj; } if (isX(obj) && isY(obj) && isZ(obj)) { obj; } } // a type guard for B function isB(toTest) { return toTest && toTest.b; } // a function that turns an A into an A & B function union...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardIntersectionTypes.2.minified.js
JavaScript
//// [typeGuardIntersectionTypes.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNarrowsPrimitiveIntersection.1.normal.js
JavaScript
//// [typeGuardNarrowsPrimitiveIntersection.ts] var value; if (isNonBlank(value)) { doThis(value); } else { doThat(value); } if (isNonBlank2(value)) { doThis2(value); } else { doThat2(value); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNarrowsPrimitiveIntersection.2.minified.js
JavaScript
//// [typeGuardNarrowsPrimitiveIntersection.ts] var value; isNonBlank(value) ? doThis(value) : doThat(value), isNonBlank2(value) ? doThis2(value) : doThat2(value);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNarrowsToLiteralType.1.normal.js
JavaScript
//// [typeGuardNarrowsToLiteralType.ts] var value; if (isFoo(value)) { doThis(value); } else { doThat(value); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNarrowsToLiteralType.2.minified.js
JavaScript
//// [typeGuardNarrowsToLiteralType.ts] var value; isFoo(value) ? doThis(value) : doThat(value);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNarrowsToLiteralTypeUnion.1.normal.js
JavaScript
//// [typeGuardNarrowsToLiteralTypeUnion.ts] var value; if (isFoo(value)) { doThis(value); } else { doThat(value); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNarrowsToLiteralTypeUnion.2.minified.js
JavaScript
//// [typeGuardNarrowsToLiteralTypeUnion.ts] var value; isFoo(value) ? doThis(value) : doThat(value);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNesting.1.normal.js
JavaScript
//// [typeGuardNesting.ts] var strOrBool; if (typeof strOrBool === 'boolean' && !strOrBool || typeof strOrBool === 'string') { var label = typeof strOrBool === 'string' ? strOrBool : "string"; var bool = typeof strOrBool === 'boolean' ? strOrBool : false; var label2 = typeof strOrBool !== 'boolean' ? strOrB...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardNesting.2.minified.js
JavaScript
//// [typeGuardNesting.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormExpr1AndExpr2.1.normal.js
JavaScript
//// [typeGuardOfFormExpr1AndExpr2.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var str; var bool; var num; var strOrNum; var strOrNumOrBool; var numOrBool; var C = function C() { "use strict"; _class_call_check(this, C); }; var c; var cOrBool; var strOrNumOrBoolOrC; // A type ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormExpr1AndExpr2.2.minified.js
JavaScript
//// [typeGuardOfFormExpr1AndExpr2.ts] var strOrNumOrBool, numOrBool, strOrNumOrBoolOrC; import "@swc/helpers/_/_class_call_check"; "string" != typeof strOrNumOrBoolOrC && "number" != typeof strOrNumOrBoolOrC && "boolean" != typeof strOrNumOrBoolOrC || (strOrNumOrBool = strOrNumOrBoolOrC), "string" != typeof strOrNumOr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormExpr1OrExpr2.1.normal.js
JavaScript
//// [typeGuardOfFormExpr1OrExpr2.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var str; var bool; var num; var strOrNum; var strOrNumOrBool; var numOrBool; var C = function C() { "use strict"; _class_call_check(this, C); }; var c; var cOrBool; var strOrNumOrBoolOrC; // A type g...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormExpr1OrExpr2.2.minified.js
JavaScript
//// [typeGuardOfFormExpr1OrExpr2.ts] var strOrNumOrBool, numOrBool, strOrNumOrBoolOrC; import "@swc/helpers/_/_class_call_check"; ("string" == typeof strOrNumOrBoolOrC || "number" == typeof strOrNumOrBoolOrC || "boolean" == typeof strOrNumOrBoolOrC) && (strOrNumOrBool = strOrNumOrBoolOrC), "string" == typeof strOrNumO...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality.1.normal.js
JavaScript
//// [typeGuardOfFormFunctionEquality.ts] switch(isString1(0, "")){ case isString2(""): default: } var x = isString1(0, "") === isString2(""); function isString3(a, b, c) { return isString1(0, c); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality.2.minified.js
JavaScript
//// [typeGuardOfFormFunctionEquality.ts] isString1(0, ""), isString2(""), isString1(0, ""), isString2("");
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js
JavaScript
//// [typeGuardOfFormInstanceOf.ts] // A type guard of the form x instanceof C, where C is of a subtype of the global type 'Function' // and C has a property named 'prototype' // - when true, narrows the type of x to the type of the 'prototype' property in C provided // it is a subtype of the type of x, or // - ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.2.minified.js
JavaScript
//// [typeGuardOfFormInstanceOf.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var ctor1, ctor2, ctor3,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormInstanceOfOnInterface.1.normal.js
JavaScript
//// [typeGuardOfFormInstanceOfOnInterface.ts] // A type guard of the form x instanceof C, where C is of a subtype of the global type 'Function' // and C has a property named 'prototype' // - when true, narrows the type of x to the type of the 'prototype' property in C provided // it is a subtype of the type of x...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormInstanceOfOnInterface.2.minified.js
JavaScript
//// [typeGuardOfFormInstanceOfOnInterface.ts] var c1, c2, d1, c1Orc2, c2Ord1; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; _instanceof(c1Orc2, c1) && c1Orc2.p1, _instanceof(c1Orc2, c2) && c1Orc2.p2, _instanceof(c1Orc2, d1) && c1Orc2.p1, _instanceof(c1Orc2, d1) && c1Orc2.p3, _instanceof(c2Ord1, c2) &&...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormIsType.1.normal.js
JavaScript
//// [typeGuardOfFormIsType.ts] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var C1 = function C1() { "use strict"; _class_call_check(this, C1); }; var C2 = fun...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormIsType.2.minified.js
JavaScript
//// [typeGuardOfFormIsType.ts] var c1Orc2, c2Ord1; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; c1Orc2.p1, c1Orc2.p2, c1Orc2.p1, c1Orc2.p3, c2Ord1.p2, c2Ord1.p3, c2Ord...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormIsTypeOnInterfaces.1.normal.js
JavaScript
//// [typeGuardOfFormIsTypeOnInterfaces.ts] var str; var num; var strOrNum; function isC1(x) { return true; } function isC2(x) { return true; } function isD1(x) { return true; } var c1; var c2; var d1; var c1Orc2; str = isC1(c1Orc2) && c1Orc2.p1; // C1 num = isC2(c1Orc2) && c1Orc2.p2; // C2 str = isD1(c1Orc...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormIsTypeOnInterfaces.2.minified.js
JavaScript
//// [typeGuardOfFormIsTypeOnInterfaces.ts] var c1Orc2, c2Ord1; c1Orc2.p1, c1Orc2.p2, c1Orc2.p1, c1Orc2.p3, c2Ord1.p2, c2Ord1.p3, c2Ord1.p1;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormNotExpr.1.normal.js
JavaScript
//// [typeGuardOfFormNotExpr.ts] var str; var bool; var num; var strOrNum; var strOrNumOrBool; var numOrBool; // A type guard of the form !expr // - when true, narrows the type of x by expr when false, or // - when false, narrows the type of x by expr when true. // !typeguard1 if (!(typeof strOrNum === "string")) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormNotExpr.2.minified.js
JavaScript
//// [typeGuardOfFormNotExpr.ts] var strOrNumOrBool, numOrBool; "string" != typeof strOrNumOrBool && numOrBool !== strOrNumOrBool && (numOrBool = strOrNumOrBool);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfBoolean.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfBoolean.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); }; var str; var bool; var num; var strOrNum; var strOrBool; var numOrBool; var strOrNumOrBool; var strOrC; var numOrC; var boolOrC; v...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfBoolean.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfBoolean.ts] import "@swc/helpers/_/_class_call_check";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfEqualEqualHasNoEffect.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; var C = function C() { "use strict"; _class_call_check(this, C); }; var strOrNum; var strOrBool; var numOrBool; var strOrC; // ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfEqualEqualHasNoEffect.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts] var strOrC; import "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; void 0 === strOrC || _type_of(strOrC);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfFunction.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfFunction.ts] import { _ as _type_of } from "@swc/helpers/_/_type_of"; function f1(x) { if (typeof x === "function") { x; // any } } function f2(x) { if (typeof x === "function") { x; // Function } } function f3(x) { if (typeof x === "function") { x;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfFunction.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfFunction.ts] import "@swc/helpers/_/_type_of";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfIsOrderIndependent.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfIsOrderIndependent.ts] var strOrNum; var strOrBool; var strOrFunc; var numOrBool; var str; var num; var bool; var func; if ("string" === typeof strOrNum) { str = strOrNum; } else { num = strOrNum; } if ("function" === typeof strOrFunc) { func = strOrFunc; } else { str = strOrF...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfIsOrderIndependent.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfIsOrderIndependent.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfNotEqualHasNoEffect.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfNotEqualHasNoEffect.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; var C = function C() { "use strict"; _class_call_check(this, C); }; var strOrNum; var strOrBool; var numOrBool; var strOrC; // ty...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfNotEqualHasNoEffect.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfNotEqualHasNoEffect.ts] var strOrC; import "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; void 0 === strOrC || _type_of(strOrC);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfNumber.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfNumber.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); }; var str; var bool; var num; var strOrNum; var strOrBool; var numOrBool; var strOrNumOrBool; var strOrC; var numOrC; var boolOrC; va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfNumber.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfNumber.ts] import "@swc/helpers/_/_class_call_check";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfOther.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfOther.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; var C = function C() { "use strict"; _class_call_check(this, C); }; var str; var bool; var num; var strOrNum; var strOrBool; var numOrBool; var...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfOther.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfOther.ts] var strOrNumOrBool, strOrC, numOrC, boolOrC; import "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; void 0 === strOrC || _type_of(strOrC), void 0 === numOrC || _type_of(numOrC), void 0 === boolOrC || _type_of(boolOrC), void 0 === strOrC |...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfPrimitiveSubtype.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfPrimitiveSubtype.ts] var a; var b; if (typeof a === "number") { var c = a; } if (typeof a === "string") { var c1 = a; } if (typeof a === "boolean") { var c2 = a; } if (typeof b === "number") { var c3 = b; } if (typeof b === "string") { var c4 = b; } if (typeof b === "boole...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfPrimitiveSubtype.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfPrimitiveSubtype.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfString.1.normal.js
JavaScript
//// [typeGuardOfFormTypeOfString.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); }; var str; var bool; var num; var strOrNum; var strOrBool; var numOrBool; var strOrNumOrBool; var strOrC; var numOrC; var boolOrC; va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFormTypeOfString.2.minified.js
JavaScript
//// [typeGuardOfFormTypeOfString.ts] import "@swc/helpers/_/_class_call_check";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFromPropNameInUnionType.1.normal.js
JavaScript
//// [typeGuardOfFromPropNameInUnionType.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var A = function A() { "use strict"; _class_call_check(this, A); }; var B = function B() { "use strict"; _class_call_chec...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardOfFromPropNameInUnionType.2.minified.js
JavaScript
//// [typeGuardOfFromPropNameInUnionType.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import "@swc/helpers/_/_instanceof";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardRedundancy.1.normal.js
JavaScript
//// [typeGuardRedundancy.ts] var x; var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; var r4 = !(typeof x === "string" || type...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardRedundancy.2.minified.js
JavaScript
//// [typeGuardRedundancy.ts] var x; "string" == typeof x && "string" == typeof x ? x.substr : x.toFixed, "string" != typeof x || "string" != typeof x ? x.toFixed : x.substr, "string" == typeof x || "string" == typeof x ? x.substr : x.toFixed, "string" != typeof x && "string" != typeof x ? x.toFixed : x.substr;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardTautologicalConsistiency.1.normal.js
JavaScript
//// [typeGuardTautologicalConsistiency.ts] var stringOrNumber; if (typeof stringOrNumber === "number") { if (typeof stringOrNumber !== "number") { stringOrNumber; } } if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { stringOrNumber; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardTautologicalConsistiency.2.minified.js
JavaScript
//// [typeGuardTautologicalConsistiency.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardTypeOfUndefined.1.normal.js
JavaScript
//// [typeGuardTypeOfUndefined.ts] // undefined type guard adds no new type information function test1(a) { if (typeof a !== "undefined") { if (typeof a === "boolean") { a; } else { a; } } else { a; } } function test2(a) { if (typeof a === "undefin...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardTypeOfUndefined.2.minified.js
JavaScript
//// [typeGuardTypeOfUndefined.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsAsAssertions.1.normal.js
JavaScript
//// [typeGuardsAsAssertions.ts] // Repro from #8513 var cond; export var none = { none: '' }; export function isSome(value) { return 'some' in value; } function someFrom(some) { return { some: some }; } export function fn(makeSome) { var result = none; result; // None while(cond){ ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsAsAssertions.2.minified.js
JavaScript
//// [typeGuardsAsAssertions.ts] var cond; export var none = { none: '' }; export function isSome(value) { return 'some' in value; } export function fn(makeSome) { for(var result = none; cond;)result = { some: isSome(result) ? result.some : makeSome() }; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsDefeat.1.normal.js
JavaScript
//// [typeGuardsDefeat.ts] // Also note that it is possible to defeat a type guard by calling a function that changes the // type of the guarded variable. function foo(x) { function f() { x = 10; } if (typeof x === "string") { f(); return x.length; // string } else { ret...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsDefeat.2.minified.js
JavaScript
//// [typeGuardsDefeat.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js
JavaScript
//// [typeGuardsInClassAccessors.ts] // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInClassAccessors.2.minified.js
JavaScript
//// [typeGuardsInClassAccessors.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js
JavaScript
//// [typeGuardsInClassMethods.ts] // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var num; var var1; var C1 = /*#__PURE__*/ function...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInClassMethods.2.minified.js
JavaScript
//// [typeGuardsInClassMethods.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInConditionalExpression.1.normal.js
JavaScript
//// [typeGuardsInConditionalExpression.ts] // In the true expression of a conditional expression, // the type of a variable or parameter is narrowed by any type guard in the condition when true, // provided the true expression contains no assignments to the variable or parameter. // In the false expression of a cond...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInConditionalExpression.2.minified.js
JavaScript
//// [typeGuardsInConditionalExpression.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInDoStatement.1.normal.js
JavaScript
//// [typeGuardsInDoStatement.ts] var cond; function a(x) { x = true; do { x; // boolean | string x = undefined; }while (typeof x === "string"); x; // number | boolean } function b(x) { x = true; do { x; // boolean | string if (cond) continue; x = undefine...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInDoStatement.2.minified.js
JavaScript
//// [typeGuardsInDoStatement.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js
JavaScript
//// [typeGuardsInExternalModule.ts] // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // local variable in external module "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(export...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInExternalModule.2.minified.js
JavaScript
//// [typeGuardsInExternalModule.ts] var var1, var2; Object.defineProperty(exports, "__esModule", { value: !0 }), Object.defineProperty(exports, "var2", { enumerable: !0, get: function() { return var2; } }), "string" == typeof var1 && var1.length;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInForStatement.1.normal.js
JavaScript
//// [typeGuardsInForStatement.ts] var cond; function a(x) { for(x = undefined; typeof x !== "number"; x = undefined){ x; // string } x; // number } function b(x) { for(x = undefined; typeof x !== "number"; x = undefined){ x; // string if (cond) continue; } x; // number }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInForStatement.2.minified.js
JavaScript
//// [typeGuardsInForStatement.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInFunction.1.normal.js
JavaScript
//// [typeGuardsInFunction.ts] // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global var num; var var1; // Inside function declaration function f(param) { // global vars in function declaration num = typeof...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInFunction.2.minified.js
JavaScript
//// [typeGuardsInFunction.ts]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInFunctionAndModuleBlock.1.normal.js
JavaScript
//// [typeGuardsInFunctionAndModuleBlock.ts] // typeguards are scoped in function/module block function foo(x) { return typeof x === "string" ? x : function f() { var b = x; // number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number }(); } func...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/tsc-references/typeGuardsInFunctionAndModuleBlock.2.minified.js
JavaScript
//// [typeGuardsInFunctionAndModuleBlock.ts] var m, m1, x, m2, x1, m21, m22; m || (m = {}), m2 || (m2 = {}), "string" == typeof x || x.toString(), m1 || (m1 = {}), (m22 = m21 || (m21 = {})).m3 || (m22.m3 = {}), "string" == typeof x1 || x1.toString();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University