_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/compiler/addMoreCallSignaturesToBaseSignature.ts_0_122
interface Foo { (): string; } interface Bar extends Foo { (key: string): string; } var a: Bar; var kitty = a();
{ "end_byte": 122, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/addMoreCallSignaturesToBaseSignature.ts" }
TypeScript/tests/cases/compiler/generics3.ts_0_170
// @declaration: true class C<T> { private x: T; } interface X { f(): string; } interface Y { f(): string; } var a: C<X>; var b: C<Y>; a = b; // Ok - should be identical
{ "end_byte": 170, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/generics3.ts" }
TypeScript/tests/cases/compiler/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.ts_0_1144
// @strict: true // the type printback for every `test` below should be "y" type ExtendedMapper<HandledInputT, OutputT, ArgsT extends any[]> = (name : string, mixed : HandledInputT, ...args : ArgsT) => OutputT; type a = ExtendedMapper<any, any, [any]>; type b = ExtendedMapper<any, any, any[]>; type test = a extends b ...
{ "end_byte": 1144, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.ts" }
TypeScript/tests/cases/compiler/functionOverloads28.ts_0_123
function foo():string; function foo(bar:string):number; function foo(bar?:any):any{ return '' } var t:any; var x = foo(t);
{ "end_byte": 123, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads28.ts" }
TypeScript/tests/cases/compiler/declarationEmitWithComposite.ts_0_225
// @composite: true // @fullEmitPaths: true // @filename: /foo/tsconfig.json { "compilerOptions": { "composite": true, "outDir": "out" } } // @filename: /foo/test.ts interface Foo { x: number; } export default Foo;
{ "end_byte": 225, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitWithComposite.ts" }
TypeScript/tests/cases/compiler/internalAliasFunctionInsideLocalModuleWithExport.ts_0_228
//@module: commonjs // @declaration: true export module a { export function foo(x: number) { return x; } } export module c { export import b = a.foo; export var bVal = b(10); export var bVal2 = b; }
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasFunctionInsideLocalModuleWithExport.ts" }
TypeScript/tests/cases/compiler/multiLineContextDiagnosticWithPretty.ts_0_75
// @pretty: true const x: {c: string} = { a: { b: '', } };
{ "end_byte": 75, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/multiLineContextDiagnosticWithPretty.ts" }
TypeScript/tests/cases/compiler/jsxNamespacePrefixIntrinsics.tsx_0_551
// @noImplicitAny: true // @jsx: preserve declare namespace JSX { interface IntrinsicElements { "ns:element": { "ns:attribute": string; }, "ns:NamespacedUpcaseAlsoIntrinsic": any, "NS:NamespacedUpcaseAlsoIntrinsic": any } } const valid = <ns:element ns:attribute="yep" />; const validUpcase1 ...
{ "end_byte": 551, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxNamespacePrefixIntrinsics.tsx" }
TypeScript/tests/cases/compiler/class2.ts_0_45
class foo { constructor() { static f = 3; } }
{ "end_byte": 45, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/class2.ts" }
TypeScript/tests/cases/compiler/importNonExportedMember4.ts_0_141
// @esModuleInterop: false // @module: commonjs // @Filename: a.ts class Foo {} export = Foo; // @Filename: b.ts import { Foo } from './a';
{ "end_byte": 141, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importNonExportedMember4.ts" }
TypeScript/tests/cases/compiler/discriminantUsingEvaluatableTemplateExpression.ts_0_299
// @strict: true // @noEmit: true // repro from https://github.com/microsoft/TypeScript/issues/53888 type S = { d: "s"; cb: (x: string) => void }; type N = { d: "n"; cb: (x: number) => void }; declare function foo(foo: S | N): void; foo({ d: `${"s"}`, cb: (x) => { x; // string }, });
{ "end_byte": 299, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/discriminantUsingEvaluatableTemplateExpression.ts" }
TypeScript/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts_0_26
class C { [a: number]; }
{ "end_byte": 26, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts" }
TypeScript/tests/cases/compiler/destructionAssignmentError.ts_0_142
declare function fn(): { a: 1, b: 2 } let a: number; let b: number; ({ a, b } = fn()); { a, b } = fn(); ({ a, b } = fn()); { a, b } = fn();
{ "end_byte": 142, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructionAssignmentError.ts" }
TypeScript/tests/cases/compiler/genericFunctionInference1.ts_0_5574
// @strict: true // @target: es2015 declare function pipe<A extends any[], B>(ab: (...args: A) => B): (...args: A) => B; declare function pipe<A extends any[], B, C>(ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; declare function pipe<A extends any[], B, C, D>(ab: (...args: A) => B, bc: (b: B) => C, cd: (...
{ "end_byte": 5574, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericFunctionInference1.ts" }
TypeScript/tests/cases/compiler/genericFunctionInference1.ts_5576_6046
const fn60 = pipe( getArray, x => x, first, ); const fn61 = pipe( getArray, identity, first, ); const fn62 = pipe( getArray, x => x, x => first(x), ); // Repro from #30297 declare function foo2<T, U = T>(fn: T, a?: U, b?: U): [T, U]; foo2(() => {}); foo2(identity); foo2(identity...
{ "end_byte": 6046, "start_byte": 5576, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericFunctionInference1.ts" }
TypeScript/tests/cases/compiler/narrowByClauseExpressionInSwitchTrue5.ts_0_2700
// @strict: true // @noEmit: true type A = { kind: "A", value: number }; type B = { kind: "B", name: string }; type C = { kind: "C", cond: boolean }; type D = { kind: "D", value: boolean }; type E = { kind: "E", x: number, y: number }; type All = A | B | C | D | E; function fn1switch(input: All) { switch (true) ...
{ "end_byte": 2700, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/narrowByClauseExpressionInSwitchTrue5.ts" }
TypeScript/tests/cases/compiler/reexportMissingDefault5.ts_0_159
// @module: system // @filename: b.d.ts declare var b: number; export { b }; // @filename: a.ts export { b } from "./b"; export { default as Foo } from "./b";
{ "end_byte": 159, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reexportMissingDefault5.ts" }
TypeScript/tests/cases/compiler/importDeclWithExportModifierInAmbientContext.ts_0_117
declare module "m" { module x { interface c { } } export import a = x.c; var b: a; }
{ "end_byte": 117, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importDeclWithExportModifierInAmbientContext.ts" }
TypeScript/tests/cases/compiler/arraySigChecking.ts_0_512
declare module M { interface iBar { t: any; } interface iFoo extends iBar { s: any; } class cFoo { t: any; } var foo: { [index: any]; }; // expect an error here } interface myInt { voidFn(): void; } var myVar: myInt; var strArray: string[] = [myVar.voidFn()]; var myArray...
{ "end_byte": 512, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/arraySigChecking.ts" }
TypeScript/tests/cases/compiler/constDeclarations.ts_0_224
// @target: ES6 // @declaration: true // No error const c1 = false; const c2: number = 23; const c3 = 0, c4 :string = "", c5 = null; for(const c4 = 0; c4 < 9; ) { break; } for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
{ "end_byte": 224, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constDeclarations.ts" }
TypeScript/tests/cases/compiler/nonExportedElementsOfMergedModules.ts_0_169
module One { enum A { X } module B { export var x; } } module One { enum A { Y } module B { export var y; } B.x; B.y; }
{ "end_byte": 169, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nonExportedElementsOfMergedModules.ts" }
TypeScript/tests/cases/compiler/es5-asyncFunctionCallExpressions.ts_0_1368
// @lib: es5,es2015.promise // @noEmitHelpers: true // @target: ES5 declare var x, y, z, a, b, c; async function callExpression0() { await x(y, z); } async function callExpression1() { (await x)(y, z); } async function callExpression2() { x(await y, z); } async function callExpression3() { x(y, awai...
{ "end_byte": 1368, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-asyncFunctionCallExpressions.ts" }
TypeScript/tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts_0_271
interface I2 { value: string; doStuff: (t: string) => string; } function f2(args: I2) { } f2({ hello: 1 }) f2({ value: '' }) f2({ value: '', what: 1 }) f2({ toString: (s) => s }) f2({ toString: (s: string) => s }) f2({ value: '', toString: (s) => s.uhhh })
{ "end_byte": 271, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts" }
TypeScript/tests/cases/compiler/superWithTypeArgument2.ts_0_103
class C<T> { foo: T; } class D<T> extends C<T> { constructor(x) { super<T>(x); } }
{ "end_byte": 103, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superWithTypeArgument2.ts" }
TypeScript/tests/cases/compiler/functionExpressionReturningItself.ts_0_67
// @declaration: true var x = function somefn() { return somefn; };
{ "end_byte": 67, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionExpressionReturningItself.ts" }
TypeScript/tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts_0_434
// Repro from #13118 interface Foo<A> { a: A; b: (x: A) => void; } declare function canYouInferThis<A>(fn: () => Foo<A>): A; const result = canYouInferThis(() => ({ a: { BLAH: 33 }, b: x => { } })) result.BLAH; // Repro from #26629 function goofus <ARGS extends any[]> (f: (...args: ARGS) => any ) ...
{ "end_byte": 434, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts" }
TypeScript/tests/cases/compiler/reachabilityChecks4.ts_0_1390
// @noFallthroughCasesInSwitch: true function foo(x, y) { switch (x) { case 1: case 2: return 1; case 3: if (y) { return 2; } case 4: return 3; } } declare function noop(): void; declare function fail(): never; fu...
{ "end_byte": 1390, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reachabilityChecks4.ts" }
TypeScript/tests/cases/compiler/noImplicitAnyModule.ts_3_460
@noImplicitAny: true declare module Module { interface Interface { // Should return error for implicit any on return type. new (); } class Class { // Should return error for implicit `any` on parameter. public f(x): any; public g(x: any); // Should not retu...
{ "end_byte": 460, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noImplicitAnyModule.ts" }
TypeScript/tests/cases/compiler/isolatedModules_resolveJsonModule_strict_outDir_commonJs.ts_0_188
// @isolatedModules: true // @resolveJsonModule: true // @strict: true // @outDir: /dist // @module: commonjs // @Filename: /a.ts import * as j from "./j.json"; // @Filename: /j.json {}
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModules_resolveJsonModule_strict_outDir_commonJs.ts" }
TypeScript/tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2.ts_0_245
// @module: commonjs // @Filename: exportSpecifierReferencingOuterDeclaration2_A.ts declare module X { export interface bar { } } // @Filename: exportSpecifierReferencingOuterDeclaration2_B.ts export { X }; export declare function foo(): X.bar;
{ "end_byte": 245, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2.ts" }
TypeScript/tests/cases/compiler/lambdaPropSelf.ts_0_325
declare var ko: any; class Person { children: string[]; constructor (public name: string, children: string[]) { this.children = ko.observableArray(children); } addChild = () => this.children.push("New child"); } class T { fo() { var x = this; } } module M { var x = thi...
{ "end_byte": 325, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/lambdaPropSelf.ts" }
TypeScript/tests/cases/compiler/excessPropertyCheckIntersectionWithRecursiveType.ts_0_2185
// @strict: true // @noEmit: true // repro from #44750 type Request = { l1: { l2: boolean } }; type Example<T> = { ex?: T | null }; type Schema1<T> = (T extends boolean ? { type: 'boolean'; } : { props: { [P in keyof T]: Schema1<T[P]> }; }) & Example<T>; export const schemaObj1: Schema1<Request> = { props: { ...
{ "end_byte": 2185, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/excessPropertyCheckIntersectionWithRecursiveType.ts" }
TypeScript/tests/cases/compiler/moduleResolution_packageJson_notAtPackageRoot_fakeScopedPackage.ts_0_432
// @noImplicitReferences: true // @traceResolution: true // Copy of `moduleResolution_packageJson_notAtPackageRoot` with `foo/@bar` instead of `foo/bar`. Should behave identically. // @Filename: /node_modules/foo/@bar/package.json { "types": "types.d.ts" } // @Filename: /node_modules/foo/package.json {} // @Filenam...
{ "end_byte": 432, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolution_packageJson_notAtPackageRoot_fakeScopedPackage.ts" }
TypeScript/tests/cases/compiler/typedArrays.ts_3_6106
@target: ES6 function CreateTypedArrayTypes() { var typedArrays = []; typedArrays[0] = Int8Array; typedArrays[1] = Uint8Array; typedArrays[2] = Int16Array; typedArrays[3] = Uint16Array; typedArrays[4] = Int32Array; typedArrays[5] = Uint32Array; typedArrays[6] = Float32Array; typedA...
{ "end_byte": 6106, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typedArrays.ts" }
TypeScript/tests/cases/compiler/ambientGetters.ts_0_115
// @target: es5 declare class A { get length() : number; } declare class B { get length() { return 0; } }
{ "end_byte": 115, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientGetters.ts" }
TypeScript/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1.ts_0_956
// @target: es6 // @declaration: true // @filename: es6ImportDefaultBindingFollowedWithNamedImport1_0.ts var a = 10; export default a; // @filename: es6ImportDefaultBindingFollowedWithNamedImport1_1.ts import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1_0"; var x1: number = defaultBindin...
{ "end_byte": 956, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1.ts" }
TypeScript/tests/cases/compiler/withImportDecl.ts_0_776
//@module: amd // @declaration: true // @Filename: withImportDecl_0.ts export class A { foo: string; } // @Filename: withImportDecl_1.ts ///<reference path='withImportDecl_0.ts'/> var simpleVar; var anotherVar: any; var varWithSimpleType: number; var varWithArrayType: number[]; var varWithInitialValue = 30; var wit...
{ "end_byte": 776, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/withImportDecl.ts" }
TypeScript/tests/cases/compiler/letDeclarations-scopes-duplicates2.ts_0_91
// @target: ES6 // @Filename: file1.ts let var1 = 0; // @Filename: file2.ts let var1 = 0;
{ "end_byte": 91, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/letDeclarations-scopes-duplicates2.ts" }
TypeScript/tests/cases/compiler/nonNullMappedType.ts_0_119
// @strict: true function f<A extends string>(p0: { [key in A]: {} | undefined }, p1: A) { const v: {} = p0[p1]!; }
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nonNullMappedType.ts" }
TypeScript/tests/cases/compiler/inferTypeArgumentsInSignatureWithRestParameters.ts_0_237
function f<T>(array: T[], ...args) { } function g(array: number[], ...args) { } function h<T>(nonarray: T, ...args) { } function i<T>(array: T[], opt?: any[]) { } var a = [1, 2, 3, 4, 5]; f(a); // OK g(a); // OK h(a); // OK i(a); // OK
{ "end_byte": 237, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferTypeArgumentsInSignatureWithRestParameters.ts" }
TypeScript/tests/cases/compiler/exportDefaultStripsFreshness.ts_0_248
// @filename: items.ts export default { foob: "a" } export const q = { foob: "b" } // @filename: index.ts import B, {q} from "./items"; interface IFoo { foo: string; } function nFoo(x: IFoo) {} nFoo(q); // for comparison nFoo(B);
{ "end_byte": 248, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportDefaultStripsFreshness.ts" }
TypeScript/tests/cases/compiler/moduleAssignmentCompat3.ts_0_122
module A { export var x = 1; } module B { export var x = ""; } var a: A; var b: B; // both errors a = b; b = a;
{ "end_byte": 122, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAssignmentCompat3.ts" }
TypeScript/tests/cases/compiler/ambientEnumElementInitializer5.ts_0_28
declare enum E { e = -0xA }
{ "end_byte": 28, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientEnumElementInitializer5.ts" }
TypeScript/tests/cases/compiler/parameterPropertyInConstructor2.ts_0_145
module mod { class Customers { constructor(public names: string); constructor(public names: string, public ages: number) { } } }
{ "end_byte": 145, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parameterPropertyInConstructor2.ts" }
TypeScript/tests/cases/compiler/genericTypeConstraints.ts_0_176
class Foo { fooMethod() {} } class FooExtended { } class Bar<T extends Foo> { } class BarExtended extends Bar<FooExtended> { constructor() { super(); } }
{ "end_byte": 176, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericTypeConstraints.ts" }
TypeScript/tests/cases/compiler/extendsUntypedModule.ts_0_381
// Test that extending an untyped module is an error, unlike extending unknownSymbol. // @noImplicitReferences: true // @noUnusedLocals: true // @Filename: /node_modules/foo/index.js This file is not read. // @Filename: /node_modules/bar/index.js Nor is this one. // @Filename: /a.ts import Foo from "foo"; import Bar...
{ "end_byte": 381, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/extendsUntypedModule.ts" }
TypeScript/tests/cases/compiler/importHelpersOutFile.ts_0_807
// @importHelpers: true // @target: es5 // @module: amd // @outfile: out.js // @filename: a.ts export class A { } // @filename: b.ts import { A } from "./a"; export class B extends A { } // @filename: c.ts import { A } from "./a"; export class C extends A { } // @filename: tslib.d.ts export declare function __extend...
{ "end_byte": 807, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersOutFile.ts" }
TypeScript/tests/cases/compiler/declFileTypeAnnotationTypeReference.ts_0_640
// @target: ES5 // @declaration: true class c { } module m { export class c { } export class g<T> { } } class g<T> { } // Just the name function foo(): c { return new c(); } function foo2() { return new c(); } // Qualified name function foo3(): m.c { return new m.c(); } function foo4() { ...
{ "end_byte": 640, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileTypeAnnotationTypeReference.ts" }
TypeScript/tests/cases/compiler/restInvalidArgumentType.ts_0_1639
enum E { v1, v2 }; function f<T extends { b: string }>(p1: T, p2: T[]) { var t: T; var i: T["b"]; var k: keyof T; var mapped_generic: {[P in keyof T]: T[P]}; var mapped: {[P in "b"]: T[P]}; var union_generic: T | { a: number }; var union_primitive: { a: number } | number; var interse...
{ "end_byte": 1639, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/restInvalidArgumentType.ts" }
TypeScript/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts_0_53
function f() { new C2(); // OK } class C2 { }
{ "end_byte": 53, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts" }
TypeScript/tests/cases/compiler/baseTypeWrappingInstantiationChain.ts_0_471
class CBaseBase<T3> { constructor(x: Parameter<T3>) { } } class CBase<T2> extends CBaseBase<Wrapper<T2>> { } class Parameter<T4> { method(t: T4) { } } class Wrapper<T5> { property: T5; } class C<T1> extends CBase<T1> { public works() { new CBaseBase<Wrapper<T1>>(this); } public also...
{ "end_byte": 471, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/baseTypeWrappingInstantiationChain.ts" }
TypeScript/tests/cases/compiler/cachedModuleResolution1.ts_0_232
// @moduleResolution: node // @traceResolution: true // @filename: /a/b/node_modules/foo.d.ts export declare let x: number // @filename: /a/b/c/d/e/app.ts import {x} from "foo"; // @filename: /a/b/c/lib.ts import {x} from "foo";
{ "end_byte": 232, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/cachedModuleResolution1.ts" }
TypeScript/tests/cases/compiler/exportDefaultWithJSDoc2.ts_1_264
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: a.js /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike */ export default /** @type {NumberLike[]} */([ ]); // @Filename: b.ts import A from './a' A[0]
{ "end_byte": 264, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportDefaultWithJSDoc2.ts" }
TypeScript/tests/cases/compiler/commentsVariableStatement1.ts_0_74
// @declaration: true // @removeComments: false /** Comment */ var v = 1;
{ "end_byte": 74, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsVariableStatement1.ts" }
TypeScript/tests/cases/compiler/thisExpressionInIndexExpression.ts_0_41
function f() { return r => r[this]; }
{ "end_byte": 41, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisExpressionInIndexExpression.ts" }
TypeScript/tests/cases/compiler/genericConstraintOnExtendedBuiltinTypes.ts_0_484
declare module EndGate { export interface ICloneable { Clone(): any; } } interface Number extends EndGate.ICloneable { } module EndGate.Tweening { export class Tween<T extends ICloneable>{ private _from: T; constructor(from: T) { this._from = from.Clone(); } ...
{ "end_byte": 484, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericConstraintOnExtendedBuiltinTypes.ts" }
TypeScript/tests/cases/compiler/mutrec.ts_0_331
interface A { x:B[]; } interface B { x:A[]; } function f(p: A) { return p }; var b:B; f(b); interface I1 { y:I2; } interface I2 { y:I3; } interface I3 { y:I1; } function g(p: I1) { return p }; var i2:I2; g(i2); var i3:I3; g(i3); interface I4 { y:I5; } interface I5 { y:I4; } var i4:I...
{ "end_byte": 331, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mutrec.ts" }
TypeScript/tests/cases/compiler/isolatedModulesExportDeclarationType.ts_0_573
// @isolatedModules: true // @noTypesAndSymbols: true // @Filename: /type.ts export type T = number; // @Filename: /test1.ts import { T } from "./type"; const T = 0; // Error as of #56354 export default T; // Ok // @Filename: /test2.ts import { T } from "./type"; type T = number; // Merge error export default ...
{ "end_byte": 573, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesExportDeclarationType.ts" }
TypeScript/tests/cases/compiler/implementInterfaceAnyMemberWithVoid.ts_0_106
interface I { foo(value: number); } class Bug implements I { public foo(value: number) { } }
{ "end_byte": 106, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/implementInterfaceAnyMemberWithVoid.ts" }
TypeScript/tests/cases/compiler/ambiguousCallsWhereReturnTypesAgree.ts_0_594
class TestClass { public bar(x: string): void; public bar(x: string[]): void; public bar(x: any): void { } public foo(x: string): void; public foo(x: string[]): void; public foo(x: any): void { this.bar(x); // should not error } } class TestClass2 { public bar(x: ...
{ "end_byte": 594, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambiguousCallsWhereReturnTypesAgree.ts" }
TypeScript/tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts_0_223
// @strictNullChecks: true interface N { [n: number]: string; } interface S { [s: string]: number; } let n: N; let s: S; let str: string = n[undefined]; str = n[null]; let num: number = s[undefined]; num = s[null];
{ "end_byte": 223, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts" }
TypeScript/tests/cases/compiler/privacyTypeParametersOfInterfaceDeclFile.ts_0_7419
// @module: commonjs // @declaration: true class privateClass { } export class publicClass { } class privateClassT<T> { } export class publicClassT<T> { } export interface publicInterfaceWithPrivateTypeParameters<T extends privateClass> { // Error myMethod(val: T): T; myMethod0(): publicClassT<T>; myMet...
{ "end_byte": 7419, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyTypeParametersOfInterfaceDeclFile.ts" }
TypeScript/tests/cases/compiler/conditionalTypesASI.ts_0_114
// @declaration: true // Repro from #21637 interface JSONSchema4 { a?: number extends?: string | string[] }
{ "end_byte": 114, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionalTypesASI.ts" }
TypeScript/tests/cases/compiler/typeofInternalModules.ts_0_528
module Outer { export module instantiated { export class C { } } export module uninstantiated { export interface P { } } } import importInst = Outer.instantiated; import importUninst = Outer.uninstantiated; var x1: typeof importInst.C = importInst.C; var x2: importInst.C = new x1(); va...
{ "end_byte": 528, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeofInternalModules.ts" }
TypeScript/tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts_0_174
//@noUnusedLocals:true //@noUnusedParameters:true var func = function(person: string, person2: string, person3: string) { var unused = 20; person2 = "Dummy value"; }
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts" }
TypeScript/tests/cases/compiler/declarationEmitInferredTypeAlias1.ts_3_205
@declaration: true // @skipDefaultLibCheck: true // @Filename: 0.ts { type Data = string | boolean; let obj: Data = true; } export { } // @Filename: 1.ts let v = "str" || true; export { v }
{ "end_byte": 205, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitInferredTypeAlias1.ts" }
TypeScript/tests/cases/compiler/varArgWithNoParamName.ts_0_19
function t1(...) {}
{ "end_byte": 19, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/varArgWithNoParamName.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationExtendFileModule1.ts_0_640
// @module: commonjs // @filename: map.ts import { Observable } from "./observable" (<any>Observable.prototype).map = function() { } declare module "./observable" { interface Observable<T> { map<U>(proj: (e:T) => U): Observable<U> } namespace Observable { let someAnotherValue: number; ...
{ "end_byte": 640, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationExtendFileModule1.ts" }
TypeScript/tests/cases/compiler/declarationEmitParameterProperty.ts_0_111
// @strictNullChecks: true // @declaration: true export class Foo { constructor(public bar?: string) { } }
{ "end_byte": 111, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitParameterProperty.ts" }
TypeScript/tests/cases/compiler/enumWithNaNProperty.ts_0_23
enum A { NaN = 1 }
{ "end_byte": 23, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumWithNaNProperty.ts" }
TypeScript/tests/cases/compiler/optionalTupleElementsAndUndefined.ts_0_522
// @strict: true // Repro from #50753 type UnNullify<T> = { [K in keyof T]: NonNullable<T[K]> }; type Foo = UnNullify<[a: 1, b?: 2 | undefined]>; type Test = [a: 1, b?: 2] extends Foo ? true : false; // true // Types in the following declarations should be identical var v: [1, 2?]; var v: [1, (2 | undefined)?]; ...
{ "end_byte": 522, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/optionalTupleElementsAndUndefined.ts" }
TypeScript/tests/cases/compiler/misspelledNewMetaProperty.ts_3_27
nction foo(){new.targ}
{ "end_byte": 27, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/misspelledNewMetaProperty.ts" }
TypeScript/tests/cases/compiler/deleteOperator1.ts_0_82
var a; var x: boolean = delete a; var y: any = delete a; var z: number = delete a;
{ "end_byte": 82, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deleteOperator1.ts" }
TypeScript/tests/cases/compiler/collisionExportsRequireAndFunction.ts_0_364
//@module: amd export function exports() { return 1; } export function require() { return "require"; } module m1 { function exports() { return 1; } function require() { return "require"; } } module m2 { export function exports() { return 1; } export function r...
{ "end_byte": 364, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionExportsRequireAndFunction.ts" }
TypeScript/tests/cases/compiler/unionPropertyOfProtectedAndIntersectionProperty.ts_0_1549
class Foo { protected foo = 0; } class Bar { protected foo = 0; } type Nothing<V extends Foo> = void; type Broken<V extends Array<Foo | Bar>> = { readonly [P in keyof V]: V[P] extends Foo ? Nothing<V[P]> : never; }; // The issue above, #49517, is fixed very indirectly. Here's some code // that shows the direc...
{ "end_byte": 1549, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unionPropertyOfProtectedAndIntersectionProperty.ts" }
TypeScript/tests/cases/compiler/bindingPatternOmittedExpressionNesting.ts_0_67
// @declaration: true export let [,,[,[],,[],]] = undefined as any;
{ "end_byte": 67, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/bindingPatternOmittedExpressionNesting.ts" }
TypeScript/tests/cases/compiler/propertyAccessOnObjectLiteral.ts_0_73
class A { } (<A>{}).toString(); (() => { (<A>{}).toString(); })();
{ "end_byte": 73, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propertyAccessOnObjectLiteral.ts" }
TypeScript/tests/cases/compiler/importAssertionNonstring.ts_0_418
// @module: nodenext // @filename: mod.mts import * as thing1 from "./mod.mjs" assert {field: 0}; import * as thing2 from "./mod.mjs" assert {field: `a`}; import * as thing3 from "./mod.mjs" assert {field: /a/g}; import * as thing4 from "./mod.mjs" assert {field: ["a"]}; import * as thing5 from "./mod.mjs" assert {...
{ "end_byte": 418, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importAssertionNonstring.ts" }
TypeScript/tests/cases/compiler/indexerReturningTypeParameter1.ts_0_207
interface f { groupBy<T>(): { [key: string]: T[]; }; } var a: f; var r = a.groupBy(); class c { groupBy<T>(): { [key: string]: T[]; } { return null; } } var a2: c; var r2 = a2.groupBy();
{ "end_byte": 207, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexerReturningTypeParameter1.ts" }
TypeScript/tests/cases/compiler/collisionArgumentsArrowFunctions.ts_0_429
var f1 = (i: number, ...arguments) => { //arguments is error var arguments: any[]; // no error } var f12 = (arguments: number, ...rest) => { //arguments is error var arguments = 10; // no error } var f1NoError = (arguments: number) => { // no error var arguments = 10; // no error } var f2 = (...restParamet...
{ "end_byte": 429, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionArgumentsArrowFunctions.ts" }
TypeScript/tests/cases/compiler/propagationOfPromiseInitialization.ts_0_339
interface IPromise<T> { then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>; } var foo: IPromise<number>; foo.then((x) => { // x is inferred to be a number return "asdf"; }).then((x) => { // x is inferred to be string x.length; ...
{ "end_byte": 339, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propagationOfPromiseInitialization.ts" }
TypeScript/tests/cases/compiler/genericBaseClassLiteralProperty.ts_0_257
class BaseClass<T> { public _getValue1: { (): T; }; public _getValue2: () => T; } class SubClass extends BaseClass<number> { public Error(): void { var x : number = this._getValue1(); var y : number = this._getValue2(); } }
{ "end_byte": 257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericBaseClassLiteralProperty.ts" }
TypeScript/tests/cases/compiler/parseErrorInHeritageClause1.ts_0_24
class C extends A ¬ { }
{ "end_byte": 24, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseErrorInHeritageClause1.ts" }
TypeScript/tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts_0_364
// @strict // Repro from #29520 type Test<K extends keyof any> = { [P in K | "foo"]: P extends "foo" ? true : () => any } function test<T extends Test<keyof T>>(arg: T) { return arg; } const res1 = test({ foo: true, bar() { } }); const res2 = test({ foo: true, bar: function () { } }); const res3 =...
{ "end_byte": 364, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts" }
TypeScript/tests/cases/compiler/classExpressions.ts_0_119
interface A {} let x = class B implements A { prop: number; onStart(): void { } func = () => { } };
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExpressions.ts" }
TypeScript/tests/cases/compiler/emptyTypeArgumentListWithNew.ts_0_122
class foo<T> { } new foo<>(); // https://github.com/microsoft/TypeScript/issues/33041 class noParams {} new noParams<>();
{ "end_byte": 122, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emptyTypeArgumentListWithNew.ts" }
TypeScript/tests/cases/compiler/aliasInaccessibleModule2.ts_0_135
// @declaration: true module M { module N { class C { } } import R = N; export import X = R; }
{ "end_byte": 135, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/aliasInaccessibleModule2.ts" }
TypeScript/tests/cases/compiler/privacyTypeParameterOfFunction.ts_0_4022
// @module: commonjs class privateClass { } export class publicClass { } export interface publicInterfaceWithPrivateTypeParameters { // TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1 new <T extends privateClass>(): privateClass; // TypeParameter_0_of_cons...
{ "end_byte": 4022, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyTypeParameterOfFunction.ts" }
TypeScript/tests/cases/compiler/commentsOnStaticMembers.ts_0_398
// @removeComments: false class test { /** * p1 comment appears in output */ public static p1: string = ""; /** * p2 comment does not appear in output */ public static p2: string; /** * p3 comment appears in output */ private static p3: string = ""; /** *...
{ "end_byte": 398, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsOnStaticMembers.ts" }
TypeScript/tests/cases/compiler/functionCall17.ts_0_156
function foo(a:string, b?:string, c?:number, ...d:number[]){} foo('foo', 1); foo('foo'); foo(); foo(1, 'bar'); foo('foo', 1, 3); foo('foo', 'bar', 3, 4);
{ "end_byte": 156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionCall17.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationsImports1.ts_0_722
// @module: amd // @declaration: true // @outFile: f.js // @filename: a.ts export class A {} // @filename: b.ts export class B {x: number;} // @filename: c.d.ts declare module "C" { class Cls {y: string; } } // @filename: d.ts /// <reference path="c.d.ts"/> import {A} from "./a"; import {B} from "./b"; import ...
{ "end_byte": 722, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationsImports1.ts" }
TypeScript/tests/cases/compiler/cloduleGenericOnSelfMember.ts_0_188
class ServiceBase<T> { field: T; } class Service extends ServiceBase<typeof Service.Base> { } namespace Service { export const Base = { name: "1", value: 5 }; }
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/cloduleGenericOnSelfMember.ts" }
TypeScript/tests/cases/compiler/reactImportDropped.ts_0_864
//@module: es6 //@moduleResolution: node //@target: es6 //@noImplicitAny: false //@allowSyntheticDefaultImports: true //@allowJs: true //@jsx: react //@outDir: build //@filename: react.d.ts export = React; export as namespace React; declare namespace React { function createClass(spec: any): ClassicComponentClass...
{ "end_byte": 864, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reactImportDropped.ts" }
TypeScript/tests/cases/compiler/contextualTypingOfObjectLiterals.ts_0_233
var obj1: { [x: string]: string; }; var obj2 = {x: ""}; obj1 = {}; // Ok obj1 = obj2; // Error - indexer doesn't match function f(x: { [s: string]: string }) { } f({}); // Ok f(obj1); // Ok f(obj2); // Error - indexer doesn't match
{ "end_byte": 233, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTypingOfObjectLiterals.ts" }
TypeScript/tests/cases/compiler/exportObjectRest.ts_0_170
// @module: commonjs,amd,system,es2015,esnext // @target: esnext,es5 // @noEmitHelpers: true // @noTypesAndSymbols: true export const { x, ...rest } = { x: 'x', y: 'y' };
{ "end_byte": 170, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportObjectRest.ts" }
TypeScript/tests/cases/compiler/noCircularDefinitionOnExportOfPrivateInMergedNamespace.ts_0_88
const cat = 12; class Foo {} export = Foo; declare namespace Foo { export { cat }; }
{ "end_byte": 88, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noCircularDefinitionOnExportOfPrivateInMergedNamespace.ts" }
TypeScript/tests/cases/compiler/unusedTypeParameterInFunction4.ts_0_119
//@noUnusedLocals:true //@noUnusedParameters:true function f1<X, Y, Z>() { var a: Y; var b: Z; a; b; }
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedTypeParameterInFunction4.ts" }
TypeScript/tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.ts_0_111
class A { public myMethod() { } } class B extends A { } class C extends B { private myMethod() { } }
{ "end_byte": 111, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.ts" }
TypeScript/tests/cases/compiler/systemModuleExportDefault.ts_0_228
// @module: system // @filename: file1.ts export default function() {} // @filename: file2.ts export default function foo() {} // @filename: file3.ts export default class {} // @filename: file4.ts export default class C {}
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/systemModuleExportDefault.ts" }
TypeScript/tests/cases/compiler/templateLiteralConstantEvaluation.ts_0_238
// @strict: true // @noEmit: true // https://github.com/microsoft/TypeScript/issues/58494 function fn<T>(arg: T): T { return arg; } const a = '1'; const b = a + ' 2'; const c = `${b} 3`; const d = `${b} 3` as const; fn(`${b} 3`);
{ "end_byte": 238, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/templateLiteralConstantEvaluation.ts" }