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_ecma_parser/tests/tsc/privateNameComputedPropertyName1.ts
TypeScript
// @target: esnext, es2022, es2015 class A { #a = 'a'; #b: string; readonly #c = 'c'; readonly #d: string; #e = ''; constructor() { this.#b = 'b'; this.#d = 'd'; } test() { const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' }; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameComputedPropertyName2.ts
TypeScript
// @target: esnext, es2022, es2015 let getX: (a: A) => number; class A { #x = 100; [(getX = (a: A) => a.#x, "_")]() {} } console.log(getX(new A));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameComputedPropertyName3.ts
TypeScript
// @target: esnext, es2022, es2015 class Foo { #name; constructor(name) { this.#name = name; } getValue(x) { const obj = this; class Bar { #y = 100; [obj.#name]() { return x + this.#y; } } return new Bar()[...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameComputedPropertyName4.ts
TypeScript
// @target: esnext, es2022, es2015 // @useDefineForClassFields: true // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/44113 class C1 { static #qux = 42; ["bar"] () {} } class C2 { static #qux = 42; static ["bar"] () {} } class C3 { static #qux = 42; static ["bar"] = ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameConstructorSignature.ts
TypeScript
// @target: es2015 interface D { x: number; } class C { #x; static test() { new C().#x = 10; const y = new C(); const z = new y(); z.x = 123; } } interface C { new (): D; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameDeclaration.ts
TypeScript
// @declaration: true // @target: es2015 class A { #foo: string; #bar = 6; baz: string; qux = 6; quux(): void { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameDeclarationMerging.ts
TypeScript
// @target: es6 class D {}; class C { #x; foo () { const c = new C(); c.#x; // OK const d: D = new C(); d.#x; // Error } } interface C { new (): D; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameDuplicateField.ts
TypeScript
// @strict: true // @target: es6 function Field() { // Error class A_Field_Field { #foo = "foo"; #foo = "foo"; } // Error class A_Field_Method { #foo = "foo"; #foo() { } } // Error class A_Field_Getter { #foo = "foo"; get #foo() { retur...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameES5Ban.ts
TypeScript
// @target: es5 class A { constructor() {} #field = 123; #method() {} static #sField = "hello world"; static #sMethod() {} get #acc() { return ""; } set #acc(x: string) {} static get #sAcc() { return 0; } static set #sAcc(x: number) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameEmitHelpers.ts
TypeScript
// @target: es2015 // @importHelpers: true // @isolatedModules: true // @filename: main.ts export class C { #a = 1; #b() { this.#c = 42; } set #c(v: number) { this.#a += v; } } // @filename: tslib.d.ts // these are pre-TS4.3 versions of emit helpers, which only supported private instance fields export de...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameField.ts
TypeScript
// @strict: true // @target: es6 class A { #name: string; constructor(name: string) { this.#name = name; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldAccess.ts
TypeScript
// @target: es2015 class A { #myField = "hello world"; constructor() { console.log(this.#myField); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldAssignment.ts
TypeScript
// @target: es2015 class A { #field = 0; constructor() { this.#field = 1; this.#field += 2; this.#field -= 3; this.#field /= 4; this.#field *= 5; this.#field **= 6; this.#field %= 7; this.#field <<= 8; this.#field >>= 9; this.#fiel...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldCallExpression.ts
TypeScript
// @target: es2015 class A { #fieldFunc = function() { this.x = 10; }; #fieldFunc2 = function(a, ...b) {}; x = 1; test() { this.#fieldFunc(); this.#fieldFunc?.(); const func = this.#fieldFunc; func(); new this.#fieldFunc(); const arr = [ 1, 2 ]; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldClassExpression.ts
TypeScript
// @target: es2015 class B { #foo = class { constructor() { console.log("hello"); } static test = 123; }; #foo2 = class Foo { static otherClass = 123; }; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldDestructuredBinding.ts
TypeScript
// @target: esnext, es2022, es2015 class A { #field = 1; otherObject = new A(); testObject() { return { x: 10, y: 6 }; } testArray() { return [10, 11]; } constructor() { let y: number; ({ x: this.#field, y } = this.testObject()); ([this.#field, y] = t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldInitializer.ts
TypeScript
// @target: es2015 class A { #field = 10; #uninitialized; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.ts
TypeScript
// @target: es2015 class Foo { #p: number; constructor(value: number) { this.#p = value; } t1(p: number) { (this.#p as number) = p; } t2(p: number) { (((this.#p as number))) = p; } t3(p: number) { (this.#p) = p; } t4(p: number) { (((t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldUnaryMutation.ts
TypeScript
// @target: es2015 class C { #test: number = 24; constructor() { this.#test++; this.#test--; ++this.#test; --this.#test; const a = this.#test++; const b = this.#test--; const c = ++this.#test; const d = --this.#test; for (this.#test = 0; t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameFieldsESNext.ts
TypeScript
// @target: esnext, es2022 // @useDefineForClassFields: false class C { a = 123; #a = 10; c = "hello"; #b; method() { console.log(this.#a); this.#a = "hello"; console.log(this.#b); } static #m = "test"; static #x; static test() { console.log(this.#m);...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameImplicitDeclaration.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: privateNameImplicitDeclaration.js class C { constructor() { /** @type {string} */ this.#x; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameInInExpressionUnused.ts
TypeScript
// @strict: true // @noUnusedLocals: true // @target: esnext, es2022 class Foo { #unused: undefined; // expect unused error #brand: undefined; // expect no error isFoo(v: any): v is Foo { // This should count as using/reading '#brand' return #brand in v; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameInLhsReceiverExpression.ts
TypeScript
// @target: es2015 class Test { #y = 123; static something(obj: { [key: string]: Test }) { obj[(new class { #x = 1; readonly s = "prop"; }).s].#y = 1; obj[(new class { #x = 1; readonly s = "prop"; }).s].#y += 1; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameLateSuper.ts
TypeScript
// @target: es2015 class B {} class A extends B { #x; constructor() { void 0; super(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameLateSuperUseDefineForClassFields.ts
TypeScript
// @target: esnext, es2022 // @useDefineForClassFields: true class B {} class A extends B { #x; constructor() { void 0; super(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameMethod.ts
TypeScript
// @strict: true // @target: es6 class A1 { #method(param: string): string { return ""; } constructor(name: string) { this.#method("") this.#method(1) // Error this.#method() // Error } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameMethodAssignment.ts
TypeScript
// @target: es2015 class A3 { #method() { }; constructor(a: A3, b: any) { this.#method = () => {} // Error, not writable a.#method = () => { }; // Error, not writable b.#method = () => { } //Error, not writable ({ x: this.#method } = { x: () => {}}); //Error, not writable ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameMethodAsync.ts
TypeScript
// @target: es2019 const C = class { async #bar() { return await Promise.resolve(42); } async foo() { const b = await this.#bar(); return b + (this.#baz().next().value || 0) + ((await this.#qux().next()).value || 0); } *#baz() { yield 42; } async *#qux() { yield (await Promi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameMethodCallExpression.ts
TypeScript
// @target: es2015 class AA { #method() { this.x = 10; }; #method2(a, ...b) {}; x = 1; test() { this.#method(); const func = this.#method; func(); new this.#method(); const arr = [ 1, 2 ]; this.#method2(0, ...arr, 3); const b = new this.#method2...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameMethodInStaticFieldInit.ts
TypeScript
// @target: es2015 class C { static s = new C().#method(); #method() { return 42; } } console.log(C.s);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameNestedClassNameConflict.ts
TypeScript
// @target: es2015 class A { #foo: string; constructor() { class A { #foo: string; } } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameReadonly.ts
TypeScript
// @target: es2015 const C = class { #bar() {} foo() { this.#bar = console.log("should log this then throw"); } } console.log(new C().foo());
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameSetterExprReturnValue.ts
TypeScript
// @target: es2019 class C { set #foo(a: number) {} bar() { let x = (this.#foo = 42 * 2); console.log(x); // 84 } } new C().bar();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameSetterNoGetter.ts
TypeScript
// @target: es2015 const C = class { set #x(x) {} m() { this.#x += 2; // Error } } console.log(new C().m());
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessors.ts
TypeScript
// @strict: true // @target: es6 class A1 { static get #prop() { return ""; } static set #prop(param: string) { } static get #roProp() { return ""; } constructor(name: string) { A1.#prop = ""; A1.#roProp = ""; // Error console.log(A1.#prop); console.log(A1.#roProp); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorsCallExpression.ts
TypeScript
// @target: es2015 class A { static get #fieldFunc() { return function() { A.#x = 10; } } static get #fieldFunc2() { return function(a, ...b) {}; } static #x = 1; static test() { this.#fieldFunc(); const func = this.#fieldFunc; func(); new this.#fieldFunc(); c...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorssDerivedClasses.ts
TypeScript
// @target: es2015 class Base { static get #prop(): number { return 123; } static method(x: typeof Derived) { console.log(x.#prop); } } class Derived extends Base { static method(x: typeof Derived) { console.log(x.#prop); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticAndStaticInitializer.ts
TypeScript
// @target: esnext, es2022, es2015 // @useDefineForClassFields: false class A { static #foo = 1; static #prop = 2; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticEmitHelpers.ts
TypeScript
// @target: es2015 // @importHelpers: true // @isolatedModules: true // @filename: main.ts export class S { static #a = 1; static #b() { this.#a = 42; } static get #c() { return S.#b(); } } // @filename: tslib.d.ts // these are pre-TS4.3 versions of emit helpers, which only supported private instance fie...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldAccess.ts
TypeScript
// @target: es2015 class A { static #myField = "hello world"; constructor() { console.log(A.#myField); //Ok console.log(this.#myField); //Error } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldAssignment.ts
TypeScript
// @target: es2015 class A { static #field = 0; constructor() { A.#field = 1; A.#field += 2; A.#field -= 3; A.#field /= 4; A.#field *= 5; A.#field **= 6; A.#field %= 7; A.#field <<= 8; A.#field >>= 9; A.#field >>>= 10; A.#f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldCallExpression.ts
TypeScript
// @target: es2015 class A { static #fieldFunc = function () { this.x = 10; }; static #fieldFunc2 = function (a, ...b) {}; x = 1; test() { A.#fieldFunc(); A.#fieldFunc?.(); const func = A.#fieldFunc; func(); new A.#fieldFunc(); const arr = [ 1, 2 ]; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldClassExpression.ts
TypeScript
// @target: es2015 class B { static #foo = class { constructor() { console.log("hello"); new B.#foo2(); } static test = 123; field = 10; }; static #foo2 = class Foo { static otherClass = 123; }; m() { console.log(B.#foo.test) ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldDestructuredBinding.ts
TypeScript
// @target: esnext, es2022, es2015 // @useDefineForClassFields: false class A { static #field = 1; otherClass = A; testObject() { return { x: 10, y: 6 }; } testArray() { return [10, 11]; } constructor() { let y: number; ({ x: A.#field, y } = this.testObject()...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldInitializer.ts
TypeScript
// @target: es2015, es2022, esnext // @useDefineForClassFields: false class A { static #field = 10; static #uninitialized; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldNoInitializer.ts
TypeScript
// @target: es2015, es2022, esnext const C = class { static #x; } class C2 { static #x; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldUnaryMutation.ts
TypeScript
// @target: es2015 class C { static #test: number = 24; constructor() { C.#test++; C.#test--; ++C.#test; --C.#test; const a = C.#test++; const b = C.#test--; const c = ++C.#test; const d = --C.#test; for (C.#test = 0; C.#test < 10; ++C.#te...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticMethod.ts
TypeScript
// @strict: true // @target: es6 class A1 { static #method(param: string): string { return ""; } constructor() { A1.#method("") A1.#method(1) // Error A1.#method() // Error } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticMethodAssignment.ts
TypeScript
// @target: es2015 class A3 { static #method() { }; constructor(a: typeof A3, b: any) { A3.#method = () => {} // Error, not writable a.#method = () => { }; // Error, not writable b.#method = () => { } //Error, not writable ({ x: A3.#method } = { x: () => {}}); //Error, not w...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticMethodCallExpression.ts
TypeScript
// @target: es2015 class AA { static #method() { this.x = 10; }; static #method2(a, ...b) {}; static x = 1; test() { AA.#method(); const func = AA.#method; func(); new AA.#method(); const arr = [ 1, 2 ]; AA.#method2(0, ...arr, 3); const b = new ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticMethodInStaticFieldInit.ts
TypeScript
// @target: es2015 class C { static s = C.#method(); static #method() { return 42; } } console.log(C.s);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameStaticsAndStaticMethods.ts
TypeScript
// @strict: true // @target: esnext, es2022 // @lib: esnext, es2022 // @useDefineForClassFields: false class A { static #foo(a: number) {} static async #bar(a: number) {} static async *#baz(a: number) { return 3; } static #_quux: number; static get #quux (): number { return this...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameUnused.ts
TypeScript
// @noUnusedLocals:true // @noEmit: true // @target: es2015 export class A { #used = "used"; #unused = "unused"; constructor () { console.log(this.#used); } } export class A2 { #used() { }; #unused() { }; constructor () { console.log(this.#used()); } } export class A...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNameWhenNotUseDefineForClassFieldsInEsNext.ts
TypeScript
// @strict: true // @target: esNext,es2020 // @useDefineForClassFields: false class TestWithStatics { #prop = 0 static dd = new TestWithStatics().#prop; // OK static ["X_ z_ zz"] = class Inner { #foo = 10 m() { new TestWithStatics().#prop // OK } static C = clas...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesAndFields.ts
TypeScript
// @strict: true // @target: es6 class A { #foo: number; constructor () { this.#foo = 3; } } class B extends A { #foo: string; constructor () { super(); this.#foo = "some string"; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesAndMethods.ts
TypeScript
// @target: esnext, es2022 // @lib: esnext, es2022 // @useDefineForClassFields: false class A { #foo(a: number) {} async #bar(a: number) {} async *#baz(a: number) { return 3; } #_quux: number; get #quux (): number { return this.#_quux; } set #quux (val: number) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesAndStaticMethods.ts
TypeScript
// @strict: true // @target: esnext, es2022 // @lib: esnext, es2022 // @useDefineForClassFields: false class A { static #foo(a: number) {} static async #bar(a: number) {} static async *#baz(a: number) { return 3; } static #_quux: number; static get #quux (): number { return this...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesAndkeyof.ts
TypeScript
// @strict: true // @target: es6 class A { #fooField = 3; #fooMethod() { }; get #fooProp() { return 1; }; set #fooProp(value: number) { }; bar = 3; baz = 3; } // `keyof A` should not include '#foo*' let k: keyof A = "bar"; // OK k = "baz"; // OK k = "#fooField"; // Error k = "#fooMethod"; // ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesAssertion.ts
TypeScript
// @strict: true // @target: esnext, es2022 // @useDefineForClassFields: false class Foo { #p1: (v: any) => asserts v is string = (v) => { if (typeof v !== "string") { throw new Error(); } } m1(v: unknown) { this.#p1(v); v; } } class Foo2 { #p1(v: any): ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesConstructorChain-1.ts
TypeScript
// @target: es2015 class Parent { #foo = 3; static #bar = 5; accessChildProps() { new Child().#foo; // OK (`#foo` was added when `Parent`'s constructor was called on `child`) Child.#bar; // Error: not found } } class Child extends Parent { #foo = "foo"; // OK (Child's #...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesConstructorChain-2.ts
TypeScript
// @target: es2015 class Parent<T> { #foo = 3; static #bar = 5; accessChildProps() { new Child<string>().#foo; // OK (`#foo` was added when `Parent`'s constructor was called on `child`) Child.#bar; // Error: not found } } class Child<T> extends Parent<T> { #foo = "foo"; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesIncompatibleModifiersJs.ts
TypeScript
// @allowJs: true // @checkJs: true // @strict: true // @target: es6 // @outDir: ./out // @filename: privateNamesIncompatibleModifiersJs.js class A { /** * @public */ #a = 1; /** * @private */ #b = 1; /** * @protected */ #c = 1; /** * @public */ ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesUnique-1.ts
TypeScript
// @strict: true // @target: es6 // @strictPropertyInitialization: false class A { #foo: number; } class B { #foo: number; } const b: A = new B(); // Error: Property #foo is missing
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesUnique-2.ts
TypeScript
// @target: es2015 // @filename: a.ts export class Foo { #x; copy(other: import("./b").Foo) { other.#x; // error } } // @filename: b.ts export class Foo { #x; } // @filename: main.ts import { Foo as A } from "./a"; import { Foo as B } from "./b"; const a = new A(); const b = new B(); a.co...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesUnique-3.ts
TypeScript
// @target: es2015 class A { #foo = 1; static #foo = true; // error (duplicate) // because static and instance private names // share the same lexical scope // https://tc39.es/proposal-class-fields/#prod-ClassBody } class B { static #f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesUnique-4.ts
TypeScript
// @target: es2015 class A1 { } interface A2 extends A1 { } declare const a: A2; class C { #something: number } const c: C = a;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesUnique-5.ts
TypeScript
// @strict: true // @target: es6 // @strictPropertyInitialization: false // same as privateNamesUnique-1, but with an interface class A { #foo: number; } interface A2 extends A { } class B { #foo: number; } const b: A2 = new B();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateNamesUseBeforeDef.ts
TypeScript
// @target: es2015 class A { #foo = this.#bar; // Error #bar = 3; } class A2 { #foo = this.#bar(); // No Error #bar() { return 3 }; } class A3 { #foo = this.#bar; // No Error get #bar() { return 3 }; } class B { #foo = this.#bar; // Error #bar = this.#foo; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateProtectedMembersAreNotAccessibleDestructuring.ts
TypeScript
class K { private priv; protected prot; private privateMethod() { } m() { let { priv: a, prot: b } = this; // ok let { priv, prot } = new K(); // ok } } class C extends K { m2() { let { priv: a } = this; // error let { prot: b } = this; // ok } } let k = new K...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateStaticMemberAccessibility.ts
TypeScript
class Base { private static foo: string; } class Derived extends Base { static bar = Base.foo; // error bing = () => Base.foo; // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateStaticNameShadowing.ts
TypeScript
// @target: es2015 class X { static #f = X.#m(); constructor() { X.#m(); } static #m() { const X: any = {}; // shadow the class const _a: any = {}; // shadow the first generated var X.#m(); // Should check with X as the receiver with _b as the class constructor return 1; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateStaticNotAccessibleInClodule.ts
TypeScript
// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. class C { private foo: string; private static bar: string; } module C { export var y = C.bar; // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateStaticNotAccessibleInClodule2.ts
TypeScript
// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. class C { private foo: string; private static bar: string; } class D extends C { baz: number; } module D { export var y = D.bar; // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/privateWriteOnlyAccessorRead.ts
TypeScript
// @target: es2015 class Test { set #value(v: { foo: { bar: number } }) {} set #valueRest(v: number[]) {} set #valueOne(v: number) {} set #valueCompound(v: number) {} m() { const foo = { bar: 1 }; console.log(this.#value); // error this.#value = { foo }; // ok this.#value = { foo }; // ok ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertiesOfGenericConstructorFunctions.ts
TypeScript
// @Filename: propertiesOfGenericConstructorFunctions.js // @allowJs: true // @checkJs: true // @noEmit: true /** * @template {string} K * @template V * @param {string} ik * @param {V} iv */ function Multimap(ik, iv) { /** @type {{ [s: string]: V }} */ this._map = {}; // without type annotation th...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccess.ts
TypeScript
class A { a: number; } class B extends A { b: number; } enum Compass { North, South, East, West } var numIndex: { [n: number]: string } = { 3: 'three', 'three': 'three' }; var strIndex: { [n: string]: Compass } = { 'N': Compass.North, 'E': Compass.East }; var bothIndex: { [n: string]: A; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessChain.2.ts
TypeScript
// @strict: false declare const o1: undefined | { b: string }; o1?.b; declare const o2: undefined | { b: { c: string } }; o2?.b.c; declare const o3: { b: undefined | { c: string } }; o3.b?.c;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessChain.3.ts
TypeScript
// @strict: true declare const obj: any; obj?.a++; obj?.a.b++; obj?.a--; obj?.a.b--; ++obj?.a; ++obj?.a.b; --obj?.a; --obj?.a.b; obj?.a = 1; obj?.a.b = 1; obj?.a += 1; obj?.a.b += 1; for (obj?.a in {}); for (obj?.a.b in {}); for (obj?.a of []); for (obj?.a.b of []); ({ a: obj?.a } = { a: 1 }); ({ a: obj?.a.b } = ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessChain.ts
TypeScript
// @strict: true declare const o1: undefined | { b: string }; o1?.b; declare const o2: undefined | { b: { c: string } }; o2?.b.c; declare const o3: { b: undefined | { c: string } }; o3.b?.c; declare const o4: { b?: { c: { d?: { e: string } } } }; o4.b?.c.d?.e; declare const o5: { b?(): { c: { d?: { e: string } } }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.es6.ts
TypeScript
// @target: es6 0xffffffff.toString(); 0o01234.toString(); 0b01101101.toString(); 1234..toString(); 1e0.toString();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessOnTypeParameterWithConstraints.ts
TypeScript
// generic types should behave as if they have properties of their constraint type // no errors expected class C<T extends Date> { f() { var x: T; var a = x['getDate'](); // number return a + x.getDate(); } } var r = (new C<Date>()).f(); interface I<T extends Date> { foo: T; } va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessOnTypeParameterWithConstraints2.ts
TypeScript
// generic types should behave as if they have properties of their constraint type class A { foo(): string { return ''; } } class B extends A { bar(): string { return ''; } } class C<U extends A, T extends A> { f() { var x: U; var a = x['foo'](); // should be string re...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessOnTypeParameterWithConstraints3.ts
TypeScript
// generic types should behave as if they have properties of their constraint type class A { foo(): string { return ''; } } class B extends A { bar(): string { return ''; } } class C<U extends A, T extends U> { f() { var x: T; // BUG 823818 var a = x['foo'](); // shoul...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessOnTypeParameterWithConstraints4.ts
TypeScript
class C<T extends Date> { f() { var x: T; var a = x['notHere'](); // should be string return a + x.notHere(); } } var r = (new C<Date>()).f(); interface I<T extends Date> { foo: T; } var i: I<Date>; var r2 = i.foo.notHere(); var r2b = i.foo['notHere'](); var a: { <T extends Da...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessOnTypeParameterWithConstraints5.ts
TypeScript
class A { foo(): string { return ''; } } class B extends A { bar(): string { return ''; } } class C<U extends T, T extends A> { f() { var x: U; var a = x['foo'](); // should be string return a + x.foo() + x.notHere(); } } var r = (new C<B, A>()).f(); interface I<U...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessOnTypeParameterWithoutConstraints.ts
TypeScript
class C<T> { f() { var x: T; var a = x['toString'](); // should be string return a + x.toString(); } } var r = (new C<number>()).f(); interface I<T> { foo: T; } var i: I<number>; var r2 = i.foo.toString(); var r2b = i.foo['toString'](); var a: { <T>(): T; } var r3: string = a(...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessStringIndexSignature.ts
TypeScript
interface Flags { [name: string]: boolean }; let flags: Flags; flags.b; flags.f; flags.isNotNecessarilyNeverFalse; flags['this is fine']; interface Empty { } let empty: Empty; empty.nope; empty["that's ok"];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessStringIndexSignatureNoImplicitAny.ts
TypeScript
// @noImplicitAny: true interface Flags { [name: string]: boolean } let flags: Flags; flags.b; flags.f; flags.isNotNecessarilyNeverFalse; flags['this is fine']; interface Empty { } let empty: Empty; empty.nope; empty["not allowed either"];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAccessWidening.ts
TypeScript
// @strict: true // Repro from #31762 function g1(headerNames: any) { let t = [{ hasLineBreak: false, cells: [] }]; const table = [{cells: headerNames }].concat(t); } function g2(headerNames: any) { let t = [{ hasLineBreak: false, cells: [] }]; const table = [{cells: headerNames }]["concat"](t); } /...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAndAccessorWithSameName.ts
TypeScript
class C { x: number; get x() { // error return 1; } } class D { x: number; set x(v) { } // error } class E { private x: number; get x() { // error return 1; } set x(v) { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAndFunctionWithSameName.ts
TypeScript
class C { x: number; x() { // error return 1; } } class D { x: number; x(v) { } // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAssignmentOnImportedSymbol.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: mod1.js export var hurk = {} // @Filename: bug24658.js import { hurk } from './mod1' hurk.expando = 4
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAssignmentOnParenthesizedNumber.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: bug38934.js var x = {}; // should not crash and also should not result in a property '0' on x. x[(0)] = 1;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAssignmentOnUnresolvedImportedSymbol.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: bug28576.js import x from 'arglebaz' { x.bar = 1 }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAssignmentUseParentType1.ts
TypeScript
interface N { (): boolean num: 123; } export const interfaced: N = () => true; interfaced.num = 123; export const inlined: { (): boolean; nun: 456 } = () => true; inlined.nun = 456; export const ignoreJsdoc = () => true; /** @type {string} make sure to ignore jsdoc! */ ignoreJsdoc.extra = 111
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAssignmentUseParentType2.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: propertyAssignmentUseParentType2.js /** @type {{ (): boolean; nuo: 789 }} */ export const inlined = () => true inlined.nuo = 789 /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true /** @type {789} */ duplicated.nuo = 789 /**...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyAssignmentUseParentType3.ts
TypeScript
// don't use the parent type if it's a function declaration (#33741) function foo1(): number { return 123; } foo1.toFixed = ""; function foo2(): any[] { return []; } foo2.join = ""; function foo3(): string { return ""; } foo3.trim = ""; function foo4(): ({x: number}) { return {x: 123}; } foo4.x = "4...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyNameWithoutTypeAnnotation.ts
TypeScript
class C { foo; } interface I { foo; } var a: { foo; } var b = { foo: null } // These should all be of type 'any' var r1 = (new C()).foo; var r2 = (<I>null).foo; var r3 = a.foo; var r4 = b.foo;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyNamedPrototype.ts
TypeScript
class C { prototype: number; // ok static prototype: C; // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/propertyNamesOfReservedWords.ts
TypeScript
class C { abstract; as; boolean; break; byte; case; catch; char; class; continue; const; debugger; default; delete; do; double; else; enum; export; extends; false; final; finally; float; for; function; goto; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University