_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldAccess.ts_0_124
// @target: es2015 class A { #myField = "hello world"; constructor() { console.log(this.#myField); } }
{ "end_byte": 124, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldAccess.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameImplicitDeclaration.ts_0_188
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: privateNameImplicitDeclaration.js class C { constructor() { /** @type {string} */ this.#x; } }
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameImplicitDeclaration.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticEmitHelpers.ts_0_528
// @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...
{ "end_byte": 528, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticEmitHelpers.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesAndGenericClasses-2.ts_0_572
// @strict: true // @target: es6 class C<T> { #foo: T; #bar(): T { return this.#foo; } constructor(t: T) { this.#foo = t; t = this.#bar(); } set baz(t: T) { this.#foo = t; } get baz(): T { return this.#foo; } } let a = new C(3); let b = new C("hello")...
{ "end_byte": 572, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesAndGenericClasses-2.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesUnique-3.ts_0_440
// @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...
{ "end_byte": 440, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesUnique-3.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameInObjectLiteral-1.ts_0_29
const obj = { #foo: 1 };
{ "end_byte": 29, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameInObjectLiteral-1.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticMethodCallExpression.ts_0_696
// @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 ...
{ "end_byte": 696, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticMethodCallExpression.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameAccessorsCallExpression.ts_0_572
// @target: es2015 class A { get #fieldFunc() { return function() { this.x = 10; } } get #fieldFunc2() { return function(a, ...b) {}; } x = 1; test() { this.#fieldFunc(); const func = this.#fieldFunc; func(); new this.#fieldFunc(); const arr = [ 1, 2 ]; ...
{ "end_byte": 572, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameAccessorsCallExpression.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateWriteOnlyAccessorRead.ts_0_785
// @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 ...
{ "end_byte": 785, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateWriteOnlyAccessorRead.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldCallExpression.ts_0_571
// @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 ]; ...
{ "end_byte": 571, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldCallExpression.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateStaticNameShadowing.ts_0_332
// @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; ...
{ "end_byte": 332, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateStaticNameShadowing.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts_0_755
// @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' }; ...
{ "end_byte": 755, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticAndStaticInitializer.ts_0_123
// @target: esnext, es2022, es2015 // @useDefineForClassFields: false class A { static #foo = 1; static #prop = 2; }
{ "end_byte": 123, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticAndStaticInitializer.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameAndPropertySignature.ts_0_273
type A = { #foo: string; #bar(): string; } interface B { #foo: string; #bar(): string; } declare const x: { #foo: number; bar: { #baz: string; #taz(): string; } #baz(): string; }; declare const y: [{ qux: { #quux: 3 } }];
{ "end_byte": 273, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameAndPropertySignature.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesUnique-2.ts_0_336
// @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...
{ "end_byte": 336, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesUnique-2.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldCallExpression.ts_0_554
// @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 ]; ...
{ "end_byte": 554, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldCallExpression.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldAccess.ts_0_177
// @target: es2015 class A { static #myField = "hello world"; constructor() { console.log(A.#myField); //Ok console.log(this.#myField); //Error } }
{ "end_byte": 177, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldAccess.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionTransform.ts_0_1332
// @target: esnext, es2022, es2020 class Foo { #field = 1; #method() {} static #staticField= 2; static #staticMethod() {} check(v: any) { #field in v; // expect Foo's 'field' WeakMap #method in v; // expect Foo's 'instances' WeakSet #staticField in v; // expect Foo's constr...
{ "end_byte": 1332, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionTransform.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticMethodClassExpression.ts_0_291
// @target: es2015 const C = class D { static #field = D.#method(); static #method() { return 42; } static getClass() { return D; } static getField() { return C.#field }; } console.log(C.getClass().getField()); C.getClass().#method; // Error C.getClass().#field; // Error
{ "end_byte": 291, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticMethodClassExpression.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticAccessorsAccess.ts_0_395
// @target: es2015 export {} class A2 { static get #prop() { return ""; } static set #prop(param: string) { } constructor() { console.log(A2.#prop); let a: typeof A2 = A2; a.#prop; function foo (){ a.#prop; } } } A2.#prop; // Error function foo ()...
{ "end_byte": 395, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticAccessorsAccess.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts_0_475
// @target: es2015 class C { #foo = 42; #bar() { new C().#baz; } get #baz() { return 42; } m() { return class D { #bar() {} constructor() { new C().#foo; new C().#bar; // Error new C().#baz; new D().#bar; ...
{ "end_byte": 475, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameMethodAsync.ts_0_379
// @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...
{ "end_byte": 379, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameMethodAsync.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameClassExpressionLoop.ts_0_222
// @target: es2015 const array = []; for (let i = 0; i < 10; ++i) { array.push(class C { #myField = "hello"; #method() {} get #accessor() { return 42; } set #accessor(val) { } }); }
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameClassExpressionLoop.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/typeFromPrivatePropertyAssignment.ts_0_173
// @target: esnext type Foo = { foo?: string }; class C { #a?: Foo; #b?: Foo; m() { const a = this.#a || {}; this.#b = this.#b || {}; } }
{ "end_byte": 173, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/typeFromPrivatePropertyAssignment.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticMethodInStaticFieldInit.ts_0_115
// @target: es2015 class C { static s = C.#method(); static #method() { return 42; } } console.log(C.s);
{ "end_byte": 115, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticMethodInStaticFieldInit.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameWhenNotUseDefineForClassFieldsInEsNext.ts_0_1265
// @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...
{ "end_byte": 1265, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameWhenNotUseDefineForClassFieldsInEsNext.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldParenthesisLeftAssignment.ts_0_343
// @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...
{ "end_byte": 343, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldParenthesisLeftAssignment.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldDerivedClasses.ts_0_228
// @target: es2015 class Base { #prop: number = 123; static method(x: Derived) { console.log(x.#prop); } } class Derived extends Base { static method(x: Derived) { console.log(x.#prop); } }
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldDerivedClasses.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameEmitHelpers.ts_0_515
// @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...
{ "end_byte": 515, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameEmitHelpers.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameDeclarationMerging.ts_0_207
// @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; }
{ "end_byte": 207, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameDeclarationMerging.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameDeclaration.ts_0_142
// @declaration: true // @target: es2015 class A { #foo: string; #bar = 6; baz: string; qux = 6; quux(): void { } }
{ "end_byte": 142, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameDeclaration.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesAndkeyof.ts_0_427
// @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"; // ...
{ "end_byte": 427, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesAndkeyof.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameMethodAccess.ts_0_371
// @target: es2015 class A2 { #method() { return "" } constructor() { console.log(this.#method); let a: A2 = this; a.#method(); function foo (){ a.#method(); } } } new A2().#method(); // Error function foo (){ new A2().#method(); // Error } class ...
{ "end_byte": 371, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameMethodAccess.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldClassExpression.ts_0_219
// @target: es2015 class B { #foo = class { constructor() { console.log("hello"); } static test = 123; }; #foo2 = class Foo { static otherClass = 123; }; }
{ "end_byte": 219, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldClassExpression.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldAssignment.ts_0_886
// @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...
{ "end_byte": 886, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldAssignment.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameJsBadDeclaration.ts_0_381
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: privateNameJsPrototype.js function A() { } A.prototype = { #x: 1, // Error #m() {}, // Error get #p() { return "" } // Error } class B { } B.prototype = { #y: 2, // Error #m() {}, // Error get #p() { return "" } ...
{ "end_byte": 381, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameJsBadDeclaration.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesAndFields.ts_0_234
// @strict: true // @target: es6 class A { #foo: number; constructor () { this.#foo = 3; } } class B extends A { #foo: string; constructor () { super(); this.#foo = "some string"; } }
{ "end_byte": 234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesAndFields.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameSetterNoGetter.ts_0_131
// @target: es2015 const C = class { set #x(x) {} m() { this.#x += 2; // Error } } console.log(new C().m());
{ "end_byte": 131, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameSetterNoGetter.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldUnaryMutation.ts_0_933
// @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...
{ "end_byte": 933, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameStaticFieldUnaryMutation.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesAssertion.ts_0_487
// @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): ...
{ "end_byte": 487, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesAssertion.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameMethodAssignment.ts_0_400
// @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 ...
{ "end_byte": 400, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameMethodAssignment.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameLateSuper.ts_0_119
// @target: es2015 class B {} class A extends B { #x; constructor() { void 0; super(); } }
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameLateSuper.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameConstructorReserved.ts_0_101
// @target: es6 class A { #constructor() {} // Error: `#constructor` is a reserved word. }
{ "end_byte": 101, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameConstructorReserved.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameBadAssignment.ts_0_369
// @target: es2015 exports.#nope = 1; // Error (outside class body) function A() { } A.prototype.#no = 2; // Error (outside class body) class B {} B.#foo = 3; // Error (outside class body) class C { #bar = 6; constructor () { exports.#bar = 6; // Error th...
{ "end_byte": 369, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameBadAssignment.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameJsBadAssignment.ts_0_428
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: privateNameJsBadAssignment.js // @target: es2015 exports.#nope = 1; // Error (outside class body) function A() { } A.prototype.#no = 2; // Error (outside class body) class B {} B.#foo = 3; // Error (outside class bod...
{ "end_byte": 428, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameJsBadAssignment.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts_0_276
// @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) {} }
{ "end_byte": 276, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiersJs.ts_0_841
// @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 */ ...
{ "end_byte": 841, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiersJs.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesInNestedClasses-1.ts_0_581
// @strict: true // @target: es6 class A { #foo = "A's #foo"; #bar = "A's #bar"; method () { class B { #foo = "B's #foo"; bar (a: any) { a.#foo; // OK, no compile-time error, don't know what `a` is } baz (a: A) { a.#foo; // compi...
{ "end_byte": 581, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesInNestedClasses-1.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldInitializer.ts_0_69
// @target: es2015 class A { #field = 10; #uninitialized; }
{ "end_byte": 69, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldInitializer.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameNestedClassFieldShadowing.ts_0_287
// @target: es2015 class Base { #x; constructor() { class Derived { #x; testBase(x: Base) { console.log(x.#x); } testDerived(x: Derived) { console.log(x.#x); } } } }
{ "end_byte": 287, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameNestedClassFieldShadowing.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameBadSuper.ts_0_103
// @target: es2015 class B {}; class A extends B { #x; constructor() { this; super(); } }
{ "end_byte": 103, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameBadSuper.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiers.ts_0_1427
// @strict: true // @target: es6 class A { public #foo = 3; // Error private #bar = 3; // Error protected #baz = 3; // Error readonly #qux = 3; // OK declare #what: number; // Error public #fooMethod() { return 3; } // Error private #barMethod() { retur...
{ "end_byte": 1427, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiers.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts_0_398
// @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);...
{ "end_byte": 398, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts" }
TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesUseBeforeDef.ts_0_295
// @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; }
{ "end_byte": 295, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/privateNames/privateNamesUseBeforeDef.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts_0_150
class Base { private static foo: string; } class Derived extends Base { static bar = Base.foo; // error bing = () => Base.foo; // error }
{ "end_byte": 150, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass3.ts_0_323
class Base { protected x: string; method() { this.x; // OK, accessed within their declaring class } } class Derived extends Base { method1() { this.x; // OK, accessed within a subclass of the declaring class super.x; // Error, x is not public ...
{ "end_byte": 323, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass3.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts_0_2232
class Base { protected static x: string; static staticMethod() { Base.x; // OK, accessed within their declaring class Derived1.x; // OK, accessed within their declaring class Derived2.x; // OK, accessed within their declaring class Derived3.x; // Error, redefi...
{ "end_byte": 2232, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts_0_255
// 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 }
{ "end_byte": 255, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts_0_601
class Base { protected static x: string; static staticMethod() { this.x; // OK, accessed within their declaring class } } class Derived1 extends Base { static staticMethod1() { this.x; // OK, accessed within a class derived from their declaring class super.x; ...
{ "end_byte": 601, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts_0_4159
class Base { protected x: string; method() { var b: Base; var d1: Derived1; var d2: Derived2; var d3: Derived3; var d4: Derived4; b.x; // OK, accessed within their declaring class d1.x; // OK, accessed within their declaring class ...
{ "end_byte": 4159, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass.ts_0_478
// @target: ES5 // no errors class B { protected x: string; protected static x: string; } class C extends B { protected get y() { return this.x; } protected set y(x) { this.y = this.x; } protected foo() { return this.x; } protected bar() { return this.foo(); } protected static get y() { r...
{ "end_byte": 478, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinClass.ts_0_848
// no errors class C { private x: string; private get y() { return this.x; } private set y(x) { this.y = this.x; } private foo() { return this.foo; } private static x: string; private static get y() { return this.x; } private static set y(x) { this.y = this.x; } private static foo() { ...
{ "end_byte": 848, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinClass.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts_0_954
// @target: ES5 // no errors class C { protected x: string; protected get y() { return this.x; } protected set y(x) { this.y = this.x; } protected foo() { return this.foo; } protected static x: string; protected static get y() { return this.x; } protected static set y(x) { this.y = this.x;...
{ "end_byte": 954, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedStaticNotAccessibleInClodule.ts_0_295
// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. class C { public static foo: string; protected static bar: string; } module C { export var f = C.foo; // OK export var b = C.bar; // error }
{ "end_byte": 295, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedStaticNotAccessibleInClodule.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts_0_298
// 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 }
{ "end_byte": 298, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts_0_354
class C { protected x: string; protected get y() { return null; } protected set y(x) { } protected foo() { } protected static a: string; protected static get b() { return null; } protected static set b(x) { } protected static foo() { } } var c: C; // all errors c.x; c.y; c.y = 1; c.foo...
{ "end_byte": 354, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts_0_260
class C { x: string; get y() { return null; } set y(x) { } foo() { } static a: string; static get b() { return null; } static set b(x) { } static foo() { } } var c: C; c.x; c.y; c.y = 1; c.foo(); C.a; C.b(); C.b = 1; C.foo();
{ "end_byte": 260, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts_0_896
class A { protected x: string; protected f(): string { return "hello"; } } class B extends A { protected y: string; g() { var t1 = this.x; var t2 = this.f(); var t3 = this.y; var t4 = this.z; // error var s1 = super.x; // error var s2 ...
{ "end_byte": 896, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts_0_4893
class Base { protected x: string; method() { class A { methoda() { var b: Base; var d1: Derived1; var d2: Derived2; var d3: Derived3; var d4: Derived4; b.x; // OK, accessed within thei...
{ "end_byte": 4893, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinClass.ts_0_900
// @target: ES5 // no errors class C { protected x: string; protected get y() { return this.x; } protected set y(x) { this.y = this.x; } protected foo() { return this.foo; } protected static x: string; protected static get y() { return this.x; } protected static set y(x) { this.y = this.x;...
{ "end_byte": 900, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinClass.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts_0_338
class C { private x: string; private get y() { return null; } private set y(x) { } private foo() { } private static a: string; private static get b() { return null; } private static set b(x) { } private static foo() { } } var c: C; // all errors c.x; c.y; c.y = 1; c.foo(); C.a; C.b();...
{ "end_byte": 338, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts_0_211
class Base { private foo: string; } class Derived extends Base { x = super.foo; // error y() { return super.foo; // error } z: typeof super.foo; // error a: this.foo; // error }
{ "end_byte": 211, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts_0_522
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...
{ "end_byte": 522, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts_0_916
// @target: ES5 class B { protected x: string; protected static x: string; } class C extends B { protected get y() { return this.x; } protected set y(x) { this.y = this.x; } protected foo() { return this.x; } protected static get y() { return this.x; } protected static set y(x) { this.y =...
{ "end_byte": 916, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts" }
TypeScript/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts_0_932
// @target: ES5 // no errors class C { private x: string; private get y() { return this.x; } private set y(x) { this.y = this.x; } private foo() { return this.foo; } private static x: string; private static get y() { return this.x; } private static set y(x) { this.y = this.x; } private...
{ "end_byte": 932, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts" }
TypeScript/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts_0_593
class Base { constructor(x: number) { } } class C extends Base { foo: string; } var r = C; var c = new C(); // error var c2 = new C(1); // ok class Base2<T,U> { constructor(x: T) { } } class D<T,U> extends Base2<T,U> { foo: U; } var r2 = D; var d = new D(); // error var d2 = new D(1); // ok // spe...
{ "end_byte": 593, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts" }
TypeScript/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts_0_948
module NonGeneric { class C { constructor(x: string) { } } var c = new C(); // error var c2 = new C(''); // ok class C2 { constructor(x: number); constructor(x: string); constructor(x: any) { } } var c3 = new C2(); // error var c4 = new C2(''); // ok ...
{ "end_byte": 948, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts" }
TypeScript/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithStaticMembers.ts_0_317
class C { static fn() { return this; } static get x() { return 1; } static set x(v) { } constructor(public a: number, private b: number) { } static foo: string; } var r = C.fn(); var r2 = r.x; var r3 = r.foo; class D extends C { bar: string; } var r = D.fn(); var r2 = r.x; var r3 = r.foo;
{ "end_byte": 317, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithStaticMembers.ts" }
TypeScript/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithNoConstructorOrBaseClass.ts_0_158
class C { x: string; } var c = new C(); var r = C; class D<T,U> { x: T; y: U; } var d = new D(); var d2 = new D<string, number>(); var r2 = D;
{ "end_byte": 158, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/constructorFunctionTypes/classWithNoConstructorOrBaseClass.ts" }
TypeScript/tests/cases/conformance/classes/members/constructorFunctionTypes/constructorHasPrototypeProperty.ts_0_477
module NonGeneric { class C { foo: string; } class D extends C { bar: string; } var r = C.prototype; r.foo; var r2 = D.prototype; r2.bar; } module Generic { class C<T,U> { foo: T; bar: U; } class D<T,U> extends C<T,U> { baz: T; ...
{ "end_byte": 477, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/members/constructorFunctionTypes/constructorHasPrototypeProperty.ts" }
TypeScript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts_0_121
// private indexers not allowed var x = { private [x: string]: string; } var y: { private[x: string]: string; }
{ "end_byte": 121, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts" }
TypeScript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts_0_167
// private indexers not allowed class C { private [x: string]: string; } class D { private [x: number]: string; } class E<T> { private [x: string]: T; }
{ "end_byte": 167, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts" }
TypeScript/tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts_0_163
// static indexers not allowed class C { static [x: string]: string; } class D { static [x: number]: string; } class E<T> { static [x: string]: T; }
{ "end_byte": 163, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts" }
TypeScript/tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts_0_163
// public indexers not allowed class C { public [x: string]: string; } class D { public [x: number]: string; } class E<T> { public [x: string]: T; }
{ "end_byte": 163, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef3.ts_0_593
// @noEmit: true // @strict: true class A { static { A.doSomething(); // should not error } static doSomething() { console.log("gotcha!"); } } class Baz { static { console.log(FOO); // should error } } const FOO = "FOO"; class Bar { static { console.log(...
{ "end_byte": 593, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef3.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock4.ts_0_188
// @target: esnext, es2022 class C { static s1 = 1; static { this.s1; C.s1; this.s2; C.s2; } static s2 = 2; static ss2 = this.s1; }
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock4.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock1.ts_0_118
// @target: esnext, es2022, es2015, es5 const a = 2; class C { static { const a = 1; a; } }
{ "end_byte": 118, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock1.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef2.ts_0_127
// @target: esnext, es2022 // @noEmit: true // @strict: true class C { static { this.x = 1; } static x; }
{ "end_byte": 127, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef2.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock5.ts_0_223
// @target: esnext, es2022, es2015, es5 class B { static a = 1; static b = 2; } class C extends B { static b = 3; static c = super.a static { this.b; super.b; super.a; } }
{ "end_byte": 223, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock5.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock10.ts_0_429
// @target: esnext, es2022, es2015, es5 var a1 = 1; var a2 = 1; const b1 = 2; const b2 = 2; function f () { var a1 = 11; const b1 = 22; class C1 { static { var a1 = 111; var a2 = 111; const b1 = 222; const b2 = 222; } } } class C2 { ...
{ "end_byte": 429, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock10.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock24.ts_0_139
// @module: commonjs, es2015, es2020, es2022, UMD, AMD, System, esnext export class C { static x: number; static { C.x = 1; } }
{ "end_byte": 139, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock24.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock20.ts_0_164
class C { async static { // something } public static { // something } readonly private static { // something } }
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock20.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock14.ts_0_194
// @useDefineForClassFields: false // @target: es2015 class C { static #_1 = 1; static #_3 = 1; static #_5 = 1; static {} static {} static {} static {} static {} static {} }
{ "end_byte": 194, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock14.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock21.ts_0_69
class C { /* jsdocs */ static { // something } }
{ "end_byte": 69, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock21.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock15.ts_0_240
// @target: esnext, es2022, es2015 // @useDefineForClassFields: true var _C__1; class C { static #_1 = 1; static #_3 = 3; static #_5 = 5; static {} static {} static {} static {} static {} static {} } console.log(_C__1)
{ "end_byte": 240, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock15.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts_0_202
// @target: esnext, es2022, es2015 let getX; class C { #x = 1 constructor(x: number) { this.#x = x; } static { // getX has privileged access to #x getX = (obj: C) => obj.#x; } }
{ "end_byte": 202, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock25.ts_0_263
// @target: esnext, es2022 // @declaration: true // @declarationMap: true // @sourceMap: true const a = 1; const b = 2; class C { static { const a = 11; a; b; } static { const a = 11; a; b; } }
{ "end_byte": 263, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock25.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts_0_1627
// @target: esnext, es2022 let await: "any"; class C { static { let await: any; // illegal, cannot declare a new binding for await } static { let { await } = {} as any; // illegal, cannot declare a new binding for await } static { let { await: other } = {} as any; // legal } static { let ...
{ "end_byte": 1627, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock16.ts_0_401
// @target: es2015 let getX: (c: C) => number; class C { #x = 1 constructor(x: number) { this.#x = x; } static { // getX has privileged access to #x getX = (obj: C) => obj.#x; getY = (obj: D) => obj.#y; } } let getY: (c: D) => number; class D { #y = 1 static { // getY has privilege...
{ "end_byte": 401, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock16.ts" }
TypeScript/tests/cases/conformance/classes/classStaticBlock/classStaticBlock8.ts_0_1077
function foo (v: number) { label: while (v) { class C { static { if (v === 1) { break label; } if (v === 2) { continue label; } if (v === 3) { break ...
{ "end_byte": 1077, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classStaticBlock/classStaticBlock8.ts" }