_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts_0_1912 | // same as subtypingWithCallSignatures but with additional specialized signatures that should not affect the results
module CallSignature {
interface Base { // T
// M's
(x: 'a'): void;
(x: string, y: number): void;
}
// S's
interface I extends Base {
// N's
(x: ... | {
"end_byte": 1912,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts_0_2656 | // checking subtype relations for function types as it relates to contextual signature instantiation
// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain
class Base { foo: string; }
class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz... | {
"end_byte": 2656,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts_0_325 | // checking whether other types are subtypes of type parameters with constraints
function f<T extends U, U, V>(t: T, u: U, v: V) {
// ok
var r = true ? t : u;
var r = true ? u : t;
// ok
var r2 = true ? t : v;
var r2 = true ? v : t;
// ok
var r3 = true ? v : u;
var r3 = true ? u :... | {
"end_byte": 325,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures.ts_0_528 | module CallSignature {
declare function foo1(cb: (x: number) => void): typeof cb;
declare function foo1(cb: any): any;
var r = foo1((x: number) => 1); // ok because base returns void
var r2 = foo1(<T>(x: T) => ''); // ok because base returns void
declare function foo2(cb: (x: number, y: number) => ... | {
"end_byte": 528,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts_0_3447 | // checking subtype relations for function types as it relates to contextual signature instantiation
class Base { foo: string; }
class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz: string; }
class OtherDerived extends Base { bing: string; }
declare function foo1(a: new <T>(x: T) => T[]);... | {
"end_byte": 3447,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts_0_3557 | // checking whether other types are subtypes of type parameters with constraints
function f1<T extends U, U>(x: T, y: U) {
var r = true ? x : y;
var r = true ? y : x;
}
// V > U > T
function f2<T extends U, U extends V, V>(x: T, y: U, z: V) {
var r = true ? x : y;
var r = true ? y : x;
// ok
... | {
"end_byte": 3557,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts_0_103 | declare function foo3(cb: (x: number) => number): typeof cb;
var r5 = foo3((x: number) => ''); // error | {
"end_byte": 103,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts_0_5331 | // checking subtype relations for function types as it relates to contextual signature instantiation
class Base { foo: string; }
class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz: string; }
class OtherDerived extends Base { bing: string; }
declare function foo1(a: (x: number) => number[... | {
"end_byte": 5331,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts_5332_6102 | var r12b = [r12arg2, r12arg1];
var r13arg1 = <T extends Array<Derived>>(x: Array<Base>, y: T) => y;
var r13arg2 = (x: Array<Base>, y: Array<Derived>) => <Array<Derived>>null;
var r13 = foo13(r13arg1); // any
var r13a = [r13arg1, r13arg2];
var r13b = [r13arg2, r13arg1];
var r14arg1 = <T>(x: { a: T; b: T }) => x.a;
var... | {
"end_byte": 6102,
"start_byte": 5332,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithOptionalParameters.ts_0_2029 | // call signatures in derived types must have the same or fewer optional parameters as the base type
interface Base {
a: () => number;
a2: (x?: number) => number;
a3: (x: number) => number;
a4: (x: number, y?: number) => number;
a5: (x?: number, y?: number) => number;
}
interface I1 extends Base ... | {
"end_byte": 2029,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithOptionalParameters.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts_0_883 | // Derived type indexer must be subtype of base type indexer
interface Base { foo: string; }
interface Derived extends Base { bar: string; }
interface Derived2 extends Derived { baz: string; }
interface A {
[x: number]: Derived;
}
class B implements A {
[x: string]: Base; // error
}
class B2 implements A {
... | {
"end_byte": 883,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures.ts_0_667 | module ConstructSignature {
declare function foo1(cb: new (x: number) => void): typeof cb;
declare function foo1(cb: any): any;
var rarg1: new (x: number) => number;
var r = foo1(rarg1); // ok because base returns void
var rarg2: new <T>(x: T) => string;
var r2 = foo1(rarg2); // ok because base ... | {
"end_byte": 667,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts_0_3840 | // call signatures in derived types must have the same or fewer optional parameters as the base type
module ClassTypeParam {
interface Base<T> {
a: new () => T;
a2: new (x?: T) => T;
a3: new (x: T) => T;
a4: new (x: T, y?: T) => T;
a5: new (x?: T, y?: T) => T;
}
int... | {
"end_byte": 3840,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts_3842_6344 | module GenericSignaturesValid {
interface Base2 {
a: new <T>() => T;
a2: new <T>(x?: T) => T;
a3: new <T>(x: T) => T;
a4: new <T>(x: T, y?: T) => T;
a5: new <T>(x?: T, y?: T) => T;
}
// BUG 833350
interface I1 extends Base2 {
a: new <T>() => T; // ok, sa... | {
"end_byte": 6344,
"start_byte": 3842,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts_0_2679 | // string literal types are subtypes of string, any
// ok
function f1(x: 'a');
function f1(x: string);
function f1(x: string) { }
// ok
function f2(x: 'a');
function f2(x: any);
function f2(x: any) { }
// errors
function f3(x: 'a');
function f3(x: Object);
function f3(x: any) { }
function f4(x: 'a');
function f4(x:... | {
"end_byte": 2679,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts_0_2178 | // checking whether other types are subtypes of type parameters
class C3<T> {
foo: T;
}
class D1<T, U> extends C3<T> {
foo: U; // error
}
function f1<T, U>(x: T, y: U) {
var r = true ? x : y; // error
var r = true ? y : x; // error
}
interface I1 { foo: number; }
class C1 { foo: number; }
class C2<T... | {
"end_byte": 2178,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts_0_1342 | // undefined is a subtype of every other types, no errors expected below
class Base {
foo: typeof undefined;
}
class D0 extends Base {
foo: any;
}
class DA extends Base {
foo: typeof undefined;
}
class D1 extends Base {
foo: string;
}
class D1A extends Base {
foo: String;
}
class D2 extends... | {
"end_byte": 1342,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts_0_1277 | interface Base {
foo: string;
}
interface Derived extends Base {
bar: string;
}
// N and M have the same name, same accessibility, same optionality, and N is a subtype of M
// foo properties are valid, bar properties cause errors in the derived class declarations
module NotOptional {
interface A {
... | {
"end_byte": 1277,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts_0_515 | // Derived member is optional but base member is not, should be an error
interface Base { foo: string; }
interface Derived extends Base { bar: string; }
interface T {
Foo: Base;
}
interface S extends T {
Foo?: Derived // error
}
interface T2 {
1: Base;
}
interface S2 extends T2 {
1?: Derived; // er... | {
"end_byte": 515,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithOptionalParameters.ts_0_2121 | // call signatures in derived types must have the same or fewer optional parameters as the base type
interface Base {
a: new () => number;
a2: new (x?: number) => number;
a3: new (x: number) => number;
a4: new (x: number, y?: number) => number;
a5: new (x?: number, y?: number) => number;
}
interf... | {
"end_byte": 2121,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithOptionalParameters.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts_0_1312 | interface Base {
foo: string;
}
interface Derived extends Base {
bar: string;
}
// N and M have the same name, same accessibility, same optionality, and N is a subtype of M
// foo properties are valid, bar properties cause errors in the derived class declarations
module NotOptional {
interface A {
... | {
"end_byte": 1312,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality3.ts_0_512 | // Base property is optional and derived type has no property of that name
interface Base { foo: string; }
interface Derived extends Base { bar: string; }
interface T {
Foo?: Base;
}
interface S extends T {
Foo2: Derived // ok
}
interface T2 {
1?: Base;
}
interface S2 extends T2 {
2: Derived; // ok... | {
"end_byte": 512,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithOptionalProperties.ts_0_302 | // subtyping is not transitive due to optional properties but the subtyping algorithm assumes it is for the 99% case
// returns { s?: number; }
function f<T>(a: T) {
var b: { s?: number } = a;
return b;
}
var r = f({ s: new Object() }); // ok
r.s && r.s.toFixed(); // would blow up at runtime | {
"end_byte": 302,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithOptionalProperties.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts_0_1483 | // every type is a subtype of any, no errors expected
interface I {
[x: string]: any;
foo: any;
}
interface I2 {
[x: string]: any;
foo: number;
}
interface I3 {
[x: string]: any;
foo: string;
}
interface I4 {
[x: string]: any;
foo: boolean;
}
interface I5 {
[x: string]: any;... | {
"end_byte": 1483,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer4.ts_0_540 | // Derived type indexer must be subtype of base type indexer
interface Base { foo: string; }
interface Derived extends Base { bar: string; }
interface Derived2 extends Derived { baz: string; }
class A {
[x: string]: Derived;
}
class B extends A {
[x: string]: string; // error
}
module Generics {
class A... | {
"end_byte": 540,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer4.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts_0_3603 | // checking whether other types are subtypes of type parameters with constraints
class C3<T> {
foo: T;
}
class D1<T extends U, U> extends C3<T> {
[x: string]: T;
foo: T; // ok
}
class D2<T extends U, U> extends C3<U> {
[x: string]: U;
foo: T; // ok
}
class D3<T extends U, U> extends C3<T> {
... | {
"end_byte": 3603,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/widenedTypes/objectLiteralWidened.ts_0_371 | // object literal properties are widened to any
var x1 = {
foo: null,
bar: undefined
}
var y1 = {
foo: null,
bar: {
baz: null,
boo: undefined
}
}
// these are not widened
var u: undefined = undefined;
var n: null = null;
var x2 = {
foo: n,
bar: u
}
var y2 = {
foo: n... | {
"end_byte": 371,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/widenedTypes/objectLiteralWidened.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/widenedTypes/strictNullChecksNoWidening.ts_0_260 | // @strictNullChecks: true
var a1 = null;
var a2 = undefined;
var a3 = void 0;
var b1 = [];
var b2 = [,];
var b3 = [undefined];
var b4 = [[], []];
var b5 = [[], [,]];
declare function f<T>(x: T): T;
var c1 = f(null);
var c2 = f(undefined);
var c3 = f([]);
| {
"end_byte": 260,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/widenedTypes/strictNullChecksNoWidening.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/widenedTypes/initializersWidened.ts_0_462 | // these are widened to any at the point of assignment
var x1 = null;
var y1 = undefined;
var z1 = void 0;
// these are not widened
var x2: null;
var y2: undefined;
var x3: null = null;
var y3: undefined = undefined;
var z3: undefined = void 0;
// widen only when all constituents of union are widening
var x4 = nu... | {
"end_byte": 462,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/widenedTypes/initializersWidened.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/widenedTypes/arrayLiteralWidened.ts_0_465 | // array literals are widened upon assignment according to their element type
var a = []; // any[]
var a = [,,];
var a = [null, null];
var a = [undefined, undefined];
var b = [[], [null, null]]; // any[][]
var b = [[], []];
var b = [[undefined, undefined]];
var c = [[[]]]; // any[][][]
var c = [[[null]],[undefined]... | {
"end_byte": 465,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/widenedTypes/arrayLiteralWidened.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts_0_122 | // @strictNullChecks: true
// @declaration: true
interface Foo {
a?: string;
b: string;
}
<Foo>{ a: undefined }; | {
"end_byte": 122,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/equalityWithEnumTypes.ts_0_494 | // @strict: true
// Literal enum type
enum E1 {
a = 1,
b = 2,
}
// Numeric enum type
enum E2 {
a = 1 << 0,
b = 1 << 1
}
function f1(v: E1) {
if (v !== 0) { // Error
v;
}
if (v !== 1) {
v;
}
if (v !== 2) {
v;
}
if (v !== 3) { // Error
v;
... | {
"end_byte": 494,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/equalityWithEnumTypes.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts_0_268 | interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
} | {
"end_byte": 268,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/independentPropertyVariance.ts_0_183 | // @strict: true
// Verify that properties can vary independently in comparable relationship
declare const x: { a: 1, b: string };
declare const y: { a: number, b: 'a' };
x === y;
| {
"end_byte": 183,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/independentPropertyVariance.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts_1_377 | var strAndNum: string & number;
var numAndBool: number & boolean;
var str: string;
var num: number;
var bool: boolean;
switch (strAndNum) {
// Identical
case strAndNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numAndBool:
br... | {
"end_byte": 377,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts_0_249 | interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
var a = <I1 & I3>z;
var b = <I3>z;
var c = <I2>z;
var d = <I1>y;
| {
"end_byte": 249,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts_0_1201 | // @strictNullChecks: true
function f1(x: string) {
if (x == undefined) {
}
if (x != undefined) {
}
if (x === undefined) {
}
if (x !== undefined) {
}
if (x == null) {
}
if (x != null) {
}
if (x === null) {
}
if (x !== null) {
}
if (undefined == x) {
... | {
"end_byte": 1201,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts_1_372 | var strOrNum: string | number;
var numOrBool: number | boolean;
var str: string;
var num: number;
var bool: boolean;
switch (strOrNum) {
// Identical
case strOrNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numOrBool:
break;
... | {
"end_byte": 372,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts_0_306 | interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
} | {
"end_byte": 306,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/equalityWithtNullishCoalescingAssignment.ts_0_259 | // @strict: true, false
function f1(a?: boolean): void {
a ??= true;
if (a === false) {
console.log(a);
}
}
f1(false);
function f2() {
let x: 0 | 1 | 2 | 3 = 0 as any;
x ??= 1;
if (x === 0) {
console.log(x);
}
}
| {
"end_byte": 259,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/equalityWithtNullishCoalescingAssignment.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts_0_237 | // @strictNullChecks: true
// @declaration: true
interface Foo {
required1: string;
required2: string;
optional?: string;
}
const foo1 = { required1: "hello" } as Foo;
const foo2 = { required1: "hello", optional: "bar" } as Foo;
| {
"end_byte": 237,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/weakTypesAndLiterals01.ts_0_810 | // @strict: true
// @declaration: true
// @emitDeclarationOnly: true
type WeakTypes =
| { optional?: true; }
| { toLowerCase?(): string }
| { toUpperCase?(): string, otherOptionalProp?: number };
type LiteralsOrWeakTypes =
| "A"
| "B"
| WeakTypes;
declare let aOrB: "A" | "B";
const f = (arg:... | {
"end_byte": 810,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/weakTypesAndLiterals01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts_0_219 | interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
var a = <number | I2>z;
var b = <number>z;
var c = <I2>z;
var d = <I1>y;
| {
"end_byte": 219,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts_0_797 | // object types are identical structurally
class C<T> {
private foo: T;
}
class D<T> extends C<T> {
}
function foo1(x: C<string>);
function foo1(x: C<number>); // ok
function foo1(x: any) { }
function foo2(x: D<string>);
function foo2(x: D<number>); // ok
function foo2(x: any) { }
function foo3(x: C<string>);
... | {
"end_byte": 797,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.ts_0_881 | // object types are identical structurally
interface I {
(x: string): string;
}
interface I2<T> {
(x: T): T;
}
var a: { (x: string, y: string): string }
function foo2(x: I);
function foo2(x: I); // error
function foo2(x: any) { }
function foo3(x: typeof a);
function foo3(x: typeof a); // error
function foo... | {
"end_byte": 881,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts_0_2335 | // object types are identical structurally
class Base { foo: string; }
class Derived extends Base { bar: string; }
class A {
[x: number]: Base;
}
class B {
[x: number]: Derived;
}
class C<T> {
[x: number]: T;
}
interface I {
[x: number]: Derived;
}
class PA extends A {
}
class PB extends B {
}
v... | {
"end_byte": 2335,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts_0_2509 | // object types are identical structurally
class A {
foo<T>(x: T): T { return null; }
}
class B<U, V> {
foo(x: U): U { return null; }
}
class C<V, W, X> {
foo(x: V): V { return null; }
}
interface I<X, Y, Z, A> {
foo(x: X): X;
}
interface I2 {
foo<Y, Z, A, B>(x: Y): Y;
}
var a: { foo<Z, A, B, ... | {
"end_byte": 2509,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts_0_2097 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2097,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts_0_2281 | // object types are identical structurally
class A {
[x: string]: string;
}
class B {
[x: string]: string;
}
class C<T> {
[x: string]: T;
}
interface I {
[x: string]: string;
}
class PA extends A {
}
class PB extends B {
}
var a: {
[x: string]: string;
}
var b: { [x: string]: string; } = { fo... | {
"end_byte": 2281,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts_0_2058 | // object types are identical structurally
class A {
foo<T>(x: T): T { return null; }
}
class B<U> {
foo(x: U): U { return null; }
}
class C<V> {
foo(x: V): V { return null; }
}
interface I<X> {
foo(x: X): X;
}
interface I2 {
foo<Y>(x: Y): Y;
}
var a: { foo<Z>(x: Z): Z }
var b = { foo<A>(x: A)... | {
"end_byte": 2058,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts_0_2413 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2413,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts_0_1564 | // object types are identical structurally
class B<U> {
constructor(x: U) { return null; }
}
class C<V> {
constructor(x: V) { return null; }
}
interface I<X> {
new(x: X): B<X>;
}
interface I2 {
new<Y>(x: Y): C<Y>;
}
var a: { new<Z>(x: Z): B<Z> }
var b = { new<A>(x: A) { return new C<A>(x); } };
fu... | {
"end_byte": 1564,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts_3_422 | terface T1 { }
interface T2 { z }
class C1<T> {
private x;
}
class C2 extends C1<T1> {
y;
}
var c1: C1<T2>;
<C2>c1; // Should succeed (private x originates in the same declaration)
class C3<T> {
private x: T; // This T is the difference between C3 and C1
}
class C4 extends C3<T1> {
y;
}
var c3: C... | {
"end_byte": 422,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts_0_2535 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2535,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts_0_2249 | // object types are identical structurally
class A {
[x: number]: string;
}
class B {
[x: string]: string;
}
class C<T> {
[x: number]: T;
}
interface I {
[x: string]: string;
}
class PA extends A {
}
class PB extends B {
}
var a: {
[x: string]: string;
}
var b: { [x: number]: string; } = { 0:... | {
"end_byte": 2249,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/typeParametersAreIdenticalToThemselves.ts_0_1992 | // type parameters from the same declaration are identical to themself
function foo1<T>(x: T);
function foo1<T>(x: T); // no error, different declaration for each T
function foo1<T>(x: T) { }
function foo2<T, U>(x: T);
function foo2<T, U>(x: T); // no error, different declaration for each T
function foo2<T, U>(x: T) ... | {
"end_byte": 1992,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/typeParametersAreIdenticalToThemselves.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts_0_1125 | // object types are identical structurally
class A {
foo: number;
}
class B {
foo: boolean;
}
class C<T> {
foo: T;
}
interface I {
foo: Date;
}
var a: { foo: RegExp; }
enum E { A }
var b = { foo: E.A };
function foo5(x: A);
function foo5(x: B); // ok
function foo5(x: any) { }
function foo5b(x: A)... | {
"end_byte": 1125,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts_0_2587 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2587,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts_0_913 | // object types are identical structurally
interface I<X, Y, Z, A> {
(x: X): X;
}
interface I2 {
<Y, Z, A, B>(x: Y): Y;
}
var a: { <Z, A, B, C, D>(x: Z): Z }
function foo1(x: I<string, boolean, number, string>);
function foo1(x: I<string, boolean, number, string>); // error
function foo1(x: any) { }
funct... | {
"end_byte": 913,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures3.ts_0_779 | // object types are identical structurally
interface I {
(x: string): string;
}
interface I2<T> {
(x: T): T;
}
var a: { (x: string): string }
function foo2(x: I);
function foo2(x: I); // error
function foo2(x: any) { }
function foo3(x: typeof a);
function foo3(x: typeof a); // error
function foo3(x: any) {... | {
"end_byte": 779,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts_0_2324 | // object types are identical structurally
class A {
foo(x: number): number;
foo(x: string): string;
foo(x: any): any { return null; }
}
class B {
foo(x: number): number;
foo(x: string): string;
foo(x: any): any { return null; }
}
class C<T> {
foo(x: number): number;
foo(x: string): s... | {
"end_byte": 2324,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts_0_2774 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2774,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts_0_2337 | // object types are identical structurally
class Base { foo: string; }
class Derived extends Base { bar: string; }
class A {
[x: string]: Base;
}
class B {
[x: string]: Derived;
}
class C<T> {
[x: string]: T;
}
interface I {
[x: string]: Derived;
}
class PA extends A {
}
class PB extends B {
}
v... | {
"end_byte": 2337,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts_0_1986 | // object types are identical structurally
class A {
foo(x: string): string { return null; }
}
class B {
foo(x: number): string { return null; }
}
class C<T> {
foo(x: T): T { return null; }
}
interface I {
foo(x: boolean): string;
}
interface I2<T> {
foo(x: T): T;
}
var a: { foo(x: Date): stri... | {
"end_byte": 1986,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithComplexConstraints.ts_0_389 | interface A {
<T extends {
<S extends A>(x: T, y: S): void
}>(x: T, y: T): void
}
interface B {
<U extends B>(x: U, y: U): void
}
// ok, not considered identical because the steps of contextual signature instantiation create fresh type parameters
function foo(x: A);
function foo(x: B); /... | {
"end_byte": 389,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithComplexConstraints.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts_0_2642 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2642,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts_0_2596 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2596,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts_0_958 | // object types are identical structurally
class A {
foo: string;
}
class B {
foo: string;
}
class C<T> {
foo: T;
}
interface I {
foo?: string;
}
var a: { foo?: string; }
var b = { foo: '' };
function foo2(x: I);
function foo2(x: I); // error
function foo2(x: any) { }
function foo3(x: typeof a);
... | {
"end_byte": 958,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts_0_1615 | // object types are identical structurally
class B {
constructor(x: number) { return null; }
}
class C<T> {
constructor(x: T) { return null; }
}
interface I {
new(x: boolean): string;
}
interface I2<T> {
new(x: T): T;
}
var a: { new(x: Date): string }
var b = { new(x: RegExp) { return ''; } }; // n... | {
"end_byte": 1615,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts_0_1644 | // object types are identical structurally
class B {
constructor(x: string, y: string) { return null; }
}
class C<T> {
constructor(x: T, y: T) { return null; }
}
interface I {
new(x: string): string;
}
interface I2<T> {
new(x: T): T;
}
var a: { new(x: string, y: string): string }
var b = { new(x: s... | {
"end_byte": 1644,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts_0_311 | // Two types are considered identical when
// they are union types with identical sets of constituent types, or
var strOrNum: string | boolean;
var strOrNum: boolean | string;
var strOrNum: boolean | string | boolean;
var strOrNum: string; // error
var strOrNum: boolean; // error
var strOrNum: number; // error | {
"end_byte": 311,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts_0_2114 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2114,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts_0_1639 | // object types are identical structurally
class A {
constructor(x: string) { }
}
class B {
constructor(x: string) { }
}
class C<T> {
constructor(x: T) { }
}
interface I {
new(x: string);
}
interface I2<T> {
new(x: T): T;
}
var a: { new(x: string) }
function foo1(x: A);
function foo1(x: A); /... | {
"end_byte": 1639,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts_0_2140 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2140,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts_0_2364 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2364,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical.ts_0_655 | // primitive types are identical to themselves so these overloads will all cause errors
function foo1(x: number);
function foo1(x: number);
function foo1(x: any) { }
function foo2(x: string);
function foo2(x: string);
function foo2(x: any) { }
function foo3(x: boolean);
function foo3(x: boolean);
function foo3(x: an... | {
"end_byte": 655,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts_0_1663 | // object types are identical structurally
class A {
foo: string;
}
class B {
foo: string;
}
class C<T> {
foo: T;
}
interface I {
foo: string;
}
var a: { foo: string; }
var b = { foo: '' };
function foo1(x: A);
function foo1(x: A); // error
function foo1(x: any) { }
function foo1b(x: B);
function... | {
"end_byte": 1663,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts_0_2274 | // object types are identical structurally
class A {
private foo: string;
}
class B {
private foo: string;
}
class C<T> {
private foo: T;
}
interface I {
foo: string;
}
class PA extends A {
}
class PB extends B {
}
var a: { foo: string; }
var b = { foo: '' };
function foo1(x: A);
function foo1(x... | {
"end_byte": 2274,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts_0_1909 | // object types are identical structurally
class B<U, V> {
constructor(x: U) { return null; }
}
class C<V, W, X> {
constructor(x: V) { return null; }
}
interface I<X, Y, Z, A> {
new(x: X): B<X,Y>;
}
interface I2 {
new <Y, Z, A, B>(x: Y): C<Y, Z, A>;
}
var a: { new <Z, A, B, CC, D>(x: Z): C<Z, A, B>... | {
"end_byte": 1909,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts_0_1684 | // object types are identical structurally
class A {
public foo: string;
}
class B {
public foo: string;
}
class C<T> {
public foo: T;
}
interface I {
foo: string;
}
var a: { foo: string; }
var b = { foo: '' };
function foo1(x: A);
function foo1(x: A); // error
function foo1(x: any) { }
function ... | {
"end_byte": 1684,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts_0_2045 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2045,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts_0_2407 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2407,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts_0_2058 | // object types are identical structurally
class A {
foo<T>(x: T): T { return null; }
}
class B<T> {
foo(x: T): T { return null; }
}
class C<T> {
foo(x: T): T { return null; }
}
interface I<T> {
foo(x: T): T;
}
interface I2 {
foo<T>(x: T): T;
}
var a: { foo<T>(x: T): T }
var b = { foo<T>(x: T)... | {
"end_byte": 2058,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts_0_2026 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 2026,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts_0_3233 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 3233,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts_0_1996 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 1996,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts_0_2279 | // object types are identical structurally
class A {
[x: number]: string;
}
class B {
[x: number]: string;
}
class C<T> {
[x: number]: T;
}
interface I {
[x: number]: string;
}
class PA extends A {
}
class PB extends B {
}
var a: {
[x: number]: string;
}
var b: { [x: number]: string; } = { 0:... | {
"end_byte": 2279,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts_0_3349 | // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those
// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required,
// optional or rest) and types, and identical ... | {
"end_byte": 3349,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts_0_2018 | // object types are identical structurally
class A {
foo(x: string): string { return null; }
}
class B {
foo(x: string, y: string): string { return null; }
}
class C<T> {
foo(x: T, y: T): T { return null; }
}
interface I {
foo(x: string): string;
}
interface I2<T> {
foo(x: T): T;
}
var a: { fo... | {
"end_byte": 2018,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts_0_2298 | // object types are identical structurally
class A {
foo<T, U>(x: T, y: U): T { return null; }
}
class B<T, U> {
foo(x: T, y: U): T { return null; }
}
class C<T, U> {
foo(x: T, y: U): T { return null; }
}
interface I<T, U> {
foo(x: T, y: U): T;
}
interface I2 {
foo<T, U>(x: T, y: U): T;
}
var ... | {
"end_byte": 2298,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts_0_2017 | // object types are identical structurally
class A {
foo(x: string): string { return null; }
}
class B {
foo(x: string): string { return null; }
}
class C<T> {
foo(x: T): T { return null; }
}
interface I {
foo(x: string): string;
}
interface I2<T> {
foo(x: T): T;
}
var a: { foo(x: string): str... | {
"end_byte": 2017,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/arrayLiteralWithMultipleBestCommonTypes.ts_0_747 | // when multiple best common types exist we will choose the first candidate
var a: { x: number; y?: number };
var b: { x: number; z?: number };
var c: { x: number; a?: number };
var as = [a, b]; // { x: number; y?: number };[]
var bs = [b, a]; // { x: number; z?: number };[]
var cs = [a, b, c]; // { x: number; y?: nu... | {
"end_byte": 747,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/arrayLiteralWithMultipleBestCommonTypes.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts_0_1395 | // @allowUnreachableCode: true
// return type of a function with multiple returns is the BCT of each return statement
// no errors expected here
function f1() {
if (true) {
return 1;
} else {
return null;
}
}
function f2() {
if (true) {
return 1;
} else if (false) {
... | {
"end_byte": 1395,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts_0_996 | // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist)
// no errors expected here
var a: { x: number; y?: number };
var b: { x: number; z?: number };
class Base { foo: string; }
class Derived extends Base { bar: string; }
class De... | {
"end_byte": 996,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts_3_503 | nction f1(x: number): string { return "foo"; }
function f2(x: number): number { return 10; }
function f3(x: number): boolean { return true; }
enum E1 { one }
enum E2 { two }
var t1: [(x: number) => string, (x: number) => number];
var t2: [E1, E2];
var t3: [number, any];
var t4: [E1, E2, number];
// no error
t1 =... | {
"end_byte": 503,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts_0_693 | // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist)
// these are errors
class Base { foo: string; }
class Derived extends Base { bar: string; }
class Derived2 extends Base { baz: string; }
var base: Base;
var derived: Derived;
v... | {
"end_byte": 693,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts_0_4146 | // type of an array is the best common type of its elements (plus its contextual type if it exists)
var a = [1, '']; // {}[]
var b = [1, null]; // number[]
var c = [1, '', null]; // {}[]
var d = [{}, 1]; // {}[]
var e = [{}, Object]; // {}[]
var f = [[], [1]]; // number[][]
var g = [[1], ['']]; // {}[]
var h = [{ fo... | {
"end_byte": 4146,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts_3_451 | terface base { }
interface base1 { i }
class C implements base { c }
class D implements base { d }
class E implements base { e }
class F extends C { f }
class C1 implements base1 { i = "foo"; c }
class D1 extends C1 { i = "bar"; d }
var t1: [C, base];
var t2: [C, D];
var t3: [C1, D1];
var t4: [base1, C1];
var t5: [C1... | {
"end_byte": 451,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts_0_901 | // @allowUnreachableCode: true
// return type of a function with multiple returns is the BCT of each return statement
// it is an error if there is no single BCT, these are error cases
function f1() {
if (true) {
return 1;
} else {
return '';
}
}
function f2() {
if (true) {
re... | {
"end_byte": 901,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts"
} |
TypeScript/tests/cases/conformance/types/typeRelationships/recursiveTypes/nominalSubtypeCheckOfTypeParameter.ts_0_577 | interface BinaryTuple<T, S> {
first: T
second: S
}
interface Sequence<T> {
hasNext(): boolean
pop(): T
zip<S>(seq: Sequence<S>): Sequence<BinaryTuple<T, S>>
}
// error, despite the fact that the code explicitly says List<T> extends Sequence<T>, the current rules for infinitely expanding type refer... | {
"end_byte": 577,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/typeRelationships/recursiveTypes/nominalSubtypeCheckOfTypeParameter.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.