_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/thisInInstanceMemberInitializer.ts_0_65
class C { x = this; } class D<T> { x = this; y: T; }
{ "end_byte": 65, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/thisInInstanceMemberInitializer.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts_0_182
// @target: esnext, es2022, es2015, es5 // @noEmitOnError: true class C1 { accessor "w": any; accessor "x" = 1; static accessor "y": any; static accessor "z" = 2; }
{ "end_byte": 182, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors3.ts_0_588
// @target: esnext // @useDefineForClassFields: true class Animal { _sound = 'rustling noise in the bushes' get sound() { return this._sound } set sound(val) { this._sound = val; /* some important code here, perhaps tracking known sounds, etc */ } makeSound() { console.log(this...
{ "end_byte": 588, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors3.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorNoUseDefineForClassFields.ts_0_578
// @target: esnext // @useDefineForClassFields: false // @filename: file1.ts // https://github.com/microsoft/TypeScript/issues/51528 class C1 { static accessor x = 0; } // @filename: file2.ts class C2 { static accessor #x = 0; } // @filename: file3.ts class C3 { static accessor #x = 0; accessor #y = ...
{ "end_byte": 578, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorNoUseDefineForClassFields.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts_0_174
// @target: esnext, es2022, es2015, es5 // @noEmitOnError: true class C1 { accessor 0: any; accessor 1 = 1; static accessor 2: any; static accessor 3 = 2; }
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors4.ts_0_190
// @target: es5 // @useDefineForClassFields: true declare class Animal { get sound(): string set sound(val: string) } class Lion extends Animal { sound = 'RAWR!' // error here }
{ "end_byte": 190, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors4.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts_0_1495
// @strict: true class A { property = 'x'; m() { return 1 } } class B extends A { property: any; // error } class BD extends A { declare property: any; // ok because it's implicitly initialised } class BDBang extends A { declare property!: any; // ! is not allowed, this is an ambient declaration } c...
{ "end_byte": 1495, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts_0_729
// Initializer expressions for instance member variables are evaluated in the scope of the class constructor // body but are not permitted to reference parameters or local variables of the constructor. // This effectively means that entities from outer scopes by the same name as a constructor parameter or // local va...
{ "end_byte": 729, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesMethod.ts_0_115
// @target: esnext // @useDefineForClassFields: true class A { m() { } } class B extends A { m = () => 1 }
{ "end_byte": 115, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesMethod.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty9.ts_0_1215
// @strict: true // @target: es2017 // #41347, based on microsoft/rushstack // Mixin utilities export type Constructor<T = {}> = new (...args: any[]) => T; export type PropertiesOf<T> = { [K in keyof T]: T[K] }; interface IApiItemConstructor extends Constructor<ApiItem>, PropertiesOf<typeof ApiItem> {} // Base class...
{ "end_byte": 1215, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty9.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2.ts_0_852
// @target: esnext // @useDefineForClassFields: true // With useDefineForClassFields: true and ESNext target, initializer // expressions for property declarations are evaluated in the scope of // the class body and are permitted to reference parameters or local // variables of the constructor. This is different from ...
{ "end_byte": 852, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyAndFunctionWithSameName.ts_0_95
class C { static f: number; f: number; } class D { static f: number; f() { } }
{ "end_byte": 95, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyAndFunctionWithSameName.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts_0_174
// @target: esnext, es2022, es2015, es5 // @noEmitOnError: true class C1 { accessor a: any; accessor b = 1; static accessor c: any; static accessor d = 2; }
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts_0_223
// @target: esnext, es2022, es2015, es5 class C1 { accessor ["w"]: any; accessor ["x"] = 1; static accessor ["y"]: any; static accessor ["z"] = 2; } declare var f: any; class C2 { accessor [f()] = 1; }
{ "end_byte": 223, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts_0_966
// @useDefineForClassFields: true // @target: esnext class C { qux = this.bar // should error bar = this.foo // should error quiz = this.bar // ok quench = this.m1() // ok quanch = this.m3() // should error m1() { this.foo // ok } m3 = function() { } constructor(public foo: s...
{ "end_byte": 966, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts_0_8377
// @target: es5 // @useDefineForClassFields: true,false const FunctionPropertyNames = { name: 'name', length: 'length', prototype: 'prototype', caller: 'caller', arguments: 'arguments', } as const; // name class StaticName { static name: number; // error without useDefineForClassFields nam...
{ "end_byte": 8377, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts_8378_9882
module TestOnDefaultExportedClass_7 { export default class StaticCaller { static caller: number; // error without useDefineForClassFields caller: string; // ok } } export class ExportedStaticCaller { static [FunctionPropertyNames.caller]: number; // error without useDefineForClassFields ...
{ "end_byte": 9882, "start_byte": 8378, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/staticAutoAccessors.ts_0_219
// @target: es2022,es2017 // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/53752 class A { // uses class reference static accessor x = 1; // uses 'this' accessor y = 2; }
{ "end_byte": 219, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/staticAutoAccessors.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors.ts_0_291
// @target: es2015 // @useDefineForClassFields: true class A { get p() { return 'oh no' } } class B extends A { p = 'yep' // error } class C { _secret = 11 get p() { return this._secret } set p(value) { this._secret = value } } class D extends C { p = 101 // error }
{ "end_byte": 291, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors5.ts_0_176
// @target: esnext // @useDefineForClassFields: true class A { get p() { return 'oh no' } } class B extends A { constructor(public p: string) { super() } }
{ "end_byte": 176, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyOverridesAccessors5.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty.ts_0_300
// @target: esnext // @useDefineForClassFields: true class A { p = 'yep' } class B extends A { get p() { return 'oh no' } // error } class C { p = 101 } class D extends C { _secret = 11 get p() { return this._secret } // error set p(value) { this._secret = value } // error }
{ "end_byte": 300, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/abstractProperty.ts_0_280
// @target: es2015,esnext // @useDefineForClassFields: true abstract class A { protected abstract x: string; public foo() { console.log(this.x); } } class B extends A { protected x = 'B.x'; } class C extends A { protected get x() { return 'C.x' }; }
{ "end_byte": 280, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/abstractProperty.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty8.ts_0_770
// @target: es2019 type Types = 'boolean' | 'unknown' | 'string'; type Properties<T extends { [key: string]: Types }> = { readonly [key in keyof T]: T[key] extends 'boolean' ? boolean : T[key] extends 'string' ? string : unknown } type AnyCtor<P extends object> = new (...a: any[]) => P declare function classWith...
{ "end_byte": 770, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty8.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts_0_119
class C { x: number; x() { // error return 1; } } class D { x: number; x(v) { } // error }
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty3.ts_0_240
// @target: esnext // @useDefineForClassFields: true declare class Animal { sound: string } class Lion extends Animal { _sound = 'grrr' get sound() { return this._sound } // error here set sound(val) { this._sound = val } }
{ "end_byte": 240, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty3.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts_0_240
class C { static get x() { return 1; } static get x() { return 1; } // error } class D { static set x(v) { } static set x(v) { } // error } class E { static get x() { return 1; } static set x(v) { } }
{ "end_byte": 240, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts_0_554
// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. class C { a = x; // error b: typeof x; // error constructor(x) { } } class D { a = x; // error b: ...
{ "end_byte": 554, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorAllowedModifiers.ts_0_600
// @target: esnext // @noTypesAndSymbols: true abstract class C1 { accessor a: any; public accessor b: any; private accessor c: any; protected accessor d: any; abstract accessor e: any; static accessor f: any; public static accessor g: any; private static accessor h: any; protected ...
{ "end_byte": 600, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorAllowedModifiers.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/defineProperty.ts_0_418
// @target: es5, esnext // @useDefineForClassFields: true var x: "p" = "p" class A { a = this.y b public c; ["computed"] = 13 ;[x] = 14 m() { } constructor(public readonly y: number) { } z = this.y declare notEmitted; } class B { public a; } class C extends B { declare public...
{ "end_byte": 418, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/defineProperty.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty7.ts_0_156
// @target: es5 // @useDefineForClassFields: true abstract class A { abstract p = 'yep' } class B extends A { get p() { return 'oh no' } // error }
{ "end_byte": 156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty7.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName2.ts_0_165
// https://github.com/microsoft/TypeScript/issues/33857 // @useDefineForClassFields: true // @target: es2015 "use strict"; const x = 1; class C { [x]: string; }
{ "end_byte": 165, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName2.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts_0_902
// @target: esnext,es2017 // @noTypesAndSymbols: true abstract class C1 { accessor accessor a: any; readonly accessor b: any; declare accessor c: any; accessor public d: any; accessor private e: any; accessor protected f: any; accessor abstract g: any; accessor static h: any; access...
{ "end_byte": 902, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty6.ts_0_301
// @target: esnext // @useDefineForClassFields: false class A { p = 'yep' } class B extends A { get p() { return 'oh no' } // error } class C { p = 101 } class D extends C { _secret = 11 get p() { return this._secret } // error set p(value) { this._secret = value } // error }
{ "end_byte": 301, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty6.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/thisPropertyOverridesAccessors.ts_0_262
// @target: esnext // @allowjs: true // @noemit: true // @checkjs: true // @Filename: foo.ts class Foo { get p() { return 1 } set p(value) { } } // @Filename: bar.js class Bar extends Foo { constructor() { super() this.p = 2 } }
{ "end_byte": 262, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/thisPropertyOverridesAccessors.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts_0_241
class C { x = 1; } var c = new C(); c.x = 3; var c2 = new C(); var r = c.x === c2.x; // #31792 class MyMap<K, V> { constructor(private readonly Map_: { new<K, V>(): any }) {} private readonly store = new this.Map_<K, V>(); }
{ "end_byte": 241, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/propertyNamedConstructor.ts_0_80
class X1 { "constructor" = 3; // Error } class X2 { ["constructor"] = 3; }
{ "end_byte": 80, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/propertyNamedConstructor.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty2.ts_0_289
// @target: esnext // @useDefineForClassFields: true class Base { x = 1; } class Derived extends Base { get x() { return 2; } // should be an error set x(value) { console.log(`x was set to ${value}`); } } const obj = new Derived(); // nothing printed console.log(obj.x); // number
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty2.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/initializationOrdering1.ts_0_303
// @target: esnext, es2021, es2022 // @useDefineForClassFields: true, false class Helper { create(): boolean { return true } } export class Broken { constructor(readonly facade: Helper) { console.log(this.bug) } bug = this.facade.create() } new Broken(new Helper)
{ "end_byte": 303, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/initializationOrdering1.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/typeOfThisInMemberFunctions.ts_0_343
class C { foo() { var r = this; } static bar() { var r2 = this; } } class D<T> { x: T; foo() { var r = this; } static bar() { var r2 = this; } } class E<T extends Date> { x: T; foo() { var r = this; } static bar() { ...
{ "end_byte": 343, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/typeOfThisInMemberFunctions.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicOverloads.ts_0_1020
class C { public foo(x: number); public foo(x: number, y: string); public foo(x: any, y?: any) { } public bar(x: 'hi'); public bar(x: string); public bar(x: number, y: string); public bar(x: any, y?: any) { } public static foo(x: number); public static foo(x: number, y: string); ...
{ "end_byte": 1020, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicOverloads.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticMemberAssignsToConstructorFunctionMembers.ts_0_230
class C { static foo() { C.foo = () => { } } static bar(x: number): number { C.bar = () => { } // error C.bar = (x) => x; // ok C.bar = (x: number) => 1; // ok return 1; } }
{ "end_byte": 230, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticMemberAssignsToConstructorFunctionMembers.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts_0_242
class C { foo(); static foo(); // error } class D { static foo(); foo(); // error } class E<T> { foo(x: T); static foo(x: number); // error } class F<T> { static foo(x: number); foo(x: T); // error }
{ "end_byte": 242, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/instanceMemberAssignsToClassPrototype.ts_0_256
class C { foo() { C.prototype.foo = () => { } } bar(x: number): number { C.prototype.bar = () => { } // error C.prototype.bar = (x) => x; // ok C.prototype.bar = (x: number) => 1; // ok return 1; } }
{ "end_byte": 256, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/instanceMemberAssignsToClassPrototype.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticFactory1.ts_0_188
class Base { foo() { return 1; } static create() { return new this(); } } class Derived extends Base { foo() { return 2; } } var d = Derived.create(); d.foo();
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticFactory1.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts_0_1191
class C { private foo(x: number); private foo(x: number, y: string); private foo(x: any, y?: any) { } private bar(x: 'hi'); private bar(x: string); private bar(x: number, y: string); private bar(x: any, y?: any) { } private static foo(x: number); private static foo(x: number, y: st...
{ "end_byte": 1191, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts_0_1752
class C { private foo(x: number); public foo(x: number, y: string); // error private foo(x: any, y?: any) { } private bar(x: 'hi'); public bar(x: string); // error private bar(x: number, y: string); private bar(x: any, y?: any) { } private static foo(x: number); public static foo(x...
{ "end_byte": 1752, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts_0_414
class Base { foo(x: { a: number }): { a: number } { return null; } } class Derived extends Base { foo(x: { a: number; b: number }): { a: number; b: number } { return null; } bar() { var r = super.foo({ a: 1 }); // { a: number } var r2 = super.foo({ a: 1, b: 2 }); //...
{ "end_byte": 414, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts_0_168
// @target: ES5 class C { get x() { return 1; } } class D { set x(v) { } } var x = { get a() { return 1 } } var y = { set b(v) { } }
{ "end_byte": 168, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts_0_189
// accessors are not contextually typed class C { set x(v: (a: string) => string) { } get x() { return (x: string) => ""; } } var c: C; var r = c.x(''); // string
{ "end_byte": 189, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/typeOfThisInAccessor.ts_0_413
class C { get x() { var r = this; // C return 1; } static get y() { var r2 = this; // typeof C return 1; } } class D<T> { a: T; get x() { var r = this; // D<T> return 1; } static get y() { var r2 = this; // typeof D retur...
{ "end_byte": 413, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/typeOfThisInAccessor.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/ambientAccessors.ts_0_351
// @target: es5 // @declaration: true // ok to use accessors in ambient class in ES3 declare class C { static get a(): string; static set a(value: string); private static get b(): string; private static set b(foo: string); get x(): string; set x(value: string); private get y(): string; ...
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/ambientAccessors.ts" }
TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts_0_363
// @target: ES5 class C { get x() { return 1; } private set x(v) { } } class D { protected get x() { return 1; } private set x(v) { } } class E { protected set x(v) { } get x() { return 1; } } class F { protected static set x(v) { } ...
{ "end_byte": 363, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts_0_158
// @module: commonjs // @Filename: foo1.ts class x{} export = x; // @Filename: foo2.ts import foo1 = require('./foo1'); var x = foo1; class y extends x {}
{ "end_byte": 158, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classExpressionLoop.ts_0_96
let arr = []; for (let i = 0; i < 10; ++i) { arr.push(class C { prop = i; }); }
{ "end_byte": 96, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classExpressionLoop.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classExpression5.ts_0_60
new class { hi() { return "Hi!"; } }().hi();
{ "end_byte": 60, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classExpression5.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterInitializer.2.ts_0_315
// @target: esnext,es2015,es5 // @noTypesAndSymbols: true // @noEmit: true // @useDefineForClassFields: false // https://github.com/microsoft/TypeScript/issues/36295 class C {} ((b = class extends C { static x = 1 }) => { var C; })(); const x = ""; ((b = class extends C { static x = 1 }, d = x) => { var x; })();
{ "end_byte": 315, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterInitializer.2.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classExpression1.ts_0_19
var v = class C {};
{ "end_byte": 19, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classExpression1.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterInitializer.3.ts_0_303
// @target: esnext // @noTypesAndSymbols: true // @noEmit: true // @useDefineForClassFields: true // https://github.com/microsoft/TypeScript/issues/36295 class C {} ((b = class extends C { static x = 1 }) => { var C; })(); const x = ""; ((b = class extends C { static x = 1 }, d = x) => { var x; })();
{ "end_byte": 303, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterInitializer.3.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classExpression4.ts_0_84
let C = class { foo() { return new C(); } }; let x = (new C).foo();
{ "end_byte": 84, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classExpression4.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/modifierOnClassExpressionMemberInFunction.ts_3_171
@declaration: true // @declaration: true function g() { var x = class C { public prop1 = 1; private foo() { } static prop2 = 43; } }
{ "end_byte": 171, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/modifierOnClassExpressionMemberInFunction.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classExpression3.ts_0_105
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; let c = new C(); c.a; c.b; c.c;
{ "end_byte": 105, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classExpression3.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterBindingPattern.ts_0_166
// @target: esnext,es2015,es5 // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/36295 (({ [class { static x = 1 }.x]: b = "" }) => {})();
{ "end_byte": 166, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterBindingPattern.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterInitializer.ts_0_154
// @target: esnext,es2015,es5 // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/36295 ((b = class { static x = 1 }) => {})();
{ "end_byte": 154, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterInitializer.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classExpression2.ts_0_41
class D { } var v = class C extends D {};
{ "end_byte": 41, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classExpression2.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts_3_571
ass A<T> { genericVar: T } function B1<U>() { // class expression can use T return class extends A<U> { } } class B2<V> { anon = class extends A<V> { } } function B3<W>() { return class Inner<TInner> extends A<W> { } } // extends can call B class K extends B1<number>() { namae: string; } class C...
{ "end_byte": 571, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterBindingPattern.3.ts_0_328
// @target: esnext // @noTypesAndSymbols: true // @noEmit: true // @useDefineForClassFields: true // https://github.com/microsoft/TypeScript/issues/36295 class C {} (({ [class extends C { static x = 1 }.x]: b = "" }) => { var C; })(); const x = ""; (({ [class extends C { static x = 1 }.x]: b = "" }, d = x) => { var x...
{ "end_byte": 328, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterBindingPattern.3.ts" }
TypeScript/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterBindingPattern.2.ts_0_340
// @target: esnext,es2015,es5 // @noTypesAndSymbols: true // @noEmit: true // @useDefineForClassFields: false // https://github.com/microsoft/TypeScript/issues/36295 class C {} (({ [class extends C { static x = 1 }.x]: b = "" }) => { var C; })(); const x = ""; (({ [class extends C { static x = 1 }.x]: b = "" }, d = x...
{ "end_byte": 340, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/classExpressions/classWithStaticFieldInParameterBindingPattern.2.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorWithExpressionLessReturn.ts_0_263
class C { constructor() { return; } } class D { x: number; constructor() { return; } } class E { constructor(public x: number) { return; } } class F<T> { constructor(public x: T) { return; } }
{ "end_byte": 263, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorWithExpressionLessReturn.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts_0_495
// a class constructor may return an expression, it must be assignable to the class instance type to be valid class C { constructor() { return 1; } } class D { x: number; constructor() { return 1; // error } } class E { x: number; constructor() { return { x: 1 }; ...
{ "end_byte": 495, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts_0_435
// @declaration: true class A { private constructor() { } method() { class B { method() { new A(); // OK } } class C extends A { // OK } } } class D { protected constructor() { } method() { class E { met...
{ "end_byte": 435, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility3.ts_0_206
class Base { constructor(protected p: number) { } } class Derived extends Base { constructor(public p: number) { super(p); this.p; // OK } } var d: Derived; d.p; // public, OK
{ "end_byte": 206, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility3.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts_0_585
// @declaration: true class C { public constructor(public x: number) { } } class D { private constructor(public x: number) { } } class E { protected constructor(public x: number) { } } var c = new C(1); var d = new D(1); // error var e = new E(1); // error module Generic { class C<T> { publ...
{ "end_byte": 585, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts_0_493
// @declaration: true class A { public constructor(a: boolean) // error protected constructor(a: number) // error private constructor(a: string) private constructor() { } } class B { protected constructor(a: number) // error constructor(a: string) constructor() { } } class C { protected constructor...
{ "end_byte": 493, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts_0_166
class C { constructor() { } // error constructor(x) { } // error } class D<T> { constructor(x: T) { } // error constructor(x: T, y: T) { } // error }
{ "end_byte": 166, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility5.ts_0_180
class Base { protected constructor() { } } class Derived extends Base { static make() { new Base() } // ok } class Unrelated { static fake() { new Base() } // error }
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility5.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts_0_363
class C1 { constructor(public x?: number) { } } var c1: C1; c1.x // OK class C2 { constructor(private p?: number) { } } var c2: C2; c2.p // private, error class C3 { constructor(protected p?: number) { } } var c3: C3; c3.p // protected, error class Derived extends C3 { constructor(p: number) { ...
{ "end_byte": 363, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts_0_380
class C { "constructor"() { console.log(this); } } class D { 'constructor'() { console.log(this); } } class E { ['constructor']() { console.log(this); } } new class { "constructor"() { console.log(this); } }; var o = { "constructor"() {} }; class F { ...
{ "end_byte": 380, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts_0_1234
// @declaration: true class BaseA { public constructor(public x: number) { } createInstance() { new BaseA(1); } } class BaseB { protected constructor(public x: number) { } createInstance() { new BaseB(2); } } class BaseC { private constructor(public x: number) { } createInstance() { new BaseC...
{ "end_byte": 1234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts_0_506
// @declaration: true class Foo { constructor(public x: number) { } } class Bar { public constructor(public x: number) { } } class Baz { protected constructor(public x: number) { } } class Qux { private constructor(public x: number) { } } // b is public let a = Foo; a = Bar; a = Baz; // error Baz...
{ "end_byte": 506, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts_0_360
class C1 { constructor(public x: number) { } } var c1: C1; c1.x // OK class C2 { constructor(private p: number) { } } var c2: C2; c2.p // private, error class C3 { constructor(protected p: number) { } } var c3: C3; c3.p // protected, error class Derived extends C3 { constructor(p: number) { ...
{ "end_byte": 360, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperProperties.ts_0_7733
// @experimentaldecorators: true // @target: ES5 declare const decorate: any; class Base { constructor(a?) { } receivesAnything(param?) { } } class Derived1 extends Base { prop = true; constructor() { super.receivesAnything(); super(); } } class Derived2 extends Base { prop ...
{ "end_byte": 7733, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperProperties.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts_0_479
class Base { x: string; constructor(a) { } } class Derived extends Base { constructor() { super(this); // ok } } class Derived2 extends Base { constructor(public a: string) { super(this); // error } } class Derived3 extends Base { constructor(public a: string) { su...
{ "end_byte": 479, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/superCallInConstructorWithNoBaseType.ts_0_149
class C { constructor() { super(); // error } } class D<T> { public constructor(public x: T) { super(); // error } }
{ "end_byte": 149, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/superCallInConstructorWithNoBaseType.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts_0_233
class B { constructor(x?: string) {} x(): string { return ""; } } class C1 extends B { constructor() { super.x(); super(); } } class C2 extends B { constructor() { super(super.x()); } }
{ "end_byte": 233, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperStatementPosition.ts_0_1681
// @target: ES5 class DerivedBasic extends Object { prop = 1; constructor() { super(); } } class DerivedAfterParameterDefault extends Object { x1: boolean; x2: boolean; constructor(x = false) { this.x1 = x; super(x); this.x2 = x; } } class DerivedAfterRestP...
{ "end_byte": 1681, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperStatementPosition.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/emitStatementsBeforeSuperCall.ts_0_430
// @useDefineForClassFields: false // @target: es2015 class Base { } class Sub extends Base { // @ts-ignore constructor(public p: number) { console.log('hi'); // should emit before super super(); } field = 0; } class Test extends Base { prop: number; // @ts-ignore construct...
{ "end_byte": 430, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/emitStatementsBeforeSuperCall.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts_0_425
// error to use super calls outside a constructor class Base { x: string; } class Derived extends Base { a: super(); b() { super(); } get C() { super(); return 1; } set C(v) { super(); } static a: super(); static b() { super(); } ...
{ "end_byte": 425, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts_0_609
// derived class constructors must contain a super call class Base { x: string; } class Derived extends Base { constructor() { // error } } class Base2<T> { x: T; } class Derived2<T> extends Base2<T> { constructor() { // error for no super call (nested scopes don't count) var r2 = () => ...
{ "end_byte": 609, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts_0_1512
// ordering of super calls in derived constructors matters depending on other class contents class Base { x: string; } class Derived extends Base { constructor(y: string) { var a = 1; super(); } } class Derived2 extends Base { constructor(public y: string) { var a = 1; ...
{ "end_byte": 1512, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/superCalls/emitStatementsBeforeSuperCallWithDefineFields.ts_0_373
// @useDefineForClassFields: true // @target: es2015 class Base { } class Sub extends Base { // @ts-ignore constructor(public p: number) { console.log('hi'); super(); } field = 0; } class Test extends Base { prop: number; // @ts-ignore constructor(public p: number) { ...
{ "end_byte": 373, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/superCalls/emitStatementsBeforeSuperCallWithDefineFields.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts_0_277
class C { constructor(x); constructor(x = 1) { var y = x; } } class D<T> { constructor(x); constructor(x:T = null) { var y = x; } } class E<T extends Date> { constructor(x); constructor(x: T = null) { var y = x; } }
{ "end_byte": 277, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts_0_340
class C { y: string; constructor(private x: string, protected z: string) { } } var c: C; var r = c.y; var r2 = c.x; // error var r3 = c.z; // error class D<T> { y: T; constructor(a: T, private x: T, protected z: T) { } } var d: D<string>; var r = d.y; var r2 = d.x; // error var r3 = d.a; // error var...
{ "end_byte": 340, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts_0_410
class C { y: number; constructor(y: number) { } // ok } var c: C; var r = c.y; class D { y: number; constructor(public y: number) { } // error } var d: D; var r2 = d.y; class E { y: number; constructor(private y: number) { } // error } var e: E; var r3 = e.y; // error class F { y: numb...
{ "end_byte": 410, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithOptionalParameters.ts_0_179
class C { foo: string; constructor(x?, y?: any[]); constructor() { } } class D<T> { foo: string; constructor(x?, y?: any[]); constructor() { } }
{ "end_byte": 179, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithOptionalParameters.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithDefaultValues.ts_0_179
class C { foo: string; constructor(x = 1); // error constructor() { } } class D<T> { foo: string; constructor(x = 1); // error constructor() { } }
{ "end_byte": 179, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithDefaultValues.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts_0_352
class C { constructor(x); constructor(public x: string = 1) { // error var y = x; } } class D<T, U> { constructor(x: T, y: U); constructor(x: T = 1, public y: U = x) { // error var z = x; } } class E<T extends Date> { constructor(x); constructor(x: T = new Date()) { // ...
{ "end_byte": 352, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts_0_92
class C { readonly readonly x: number; constructor(readonly readonly y: number) {} }
{ "end_byte": 92, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts_0_759
// Tests that readonly parameter properties behave like regular readonly properties class A { constructor(readonly x: number) { this.x = 0; } } class B extends A { constructor(x: number) { super(x); // Fails, x is readonly this.x = 1; } } class C extends A { // Thi...
{ "end_byte": 759, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts_0_197
class C { constructor(readonly x: number) {} } new C(1).x = 2; class E { constructor(readonly public x: number) {} } class F { constructor(private readonly x: number) {} } new F(1).x;
{ "end_byte": 197, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts" }
TypeScript/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts_0_81
declare class C{ constructor(readonly x: number); method(readonly x: number); }
{ "end_byte": 81, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts" }