_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/compiler/defaultParameterTrailingComments.ts_0_136
class C { constructor(defaultParam: boolean = false /* Emit only once*/) {} } function foo(defaultParam = 10 /*emit only once*/) {}
{ "end_byte": 136, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/defaultParameterTrailingComments.ts" }
TypeScript/tests/cases/compiler/enumsWithMultipleDeclarations2.ts_0_50
enum E { A } enum E { B = 1 } enum E { C }
{ "end_byte": 50, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumsWithMultipleDeclarations2.ts" }
TypeScript/tests/cases/compiler/declFileClassWithIndexSignature.ts_0_73
// @declaration: true class BlockIntrinsics { [s: string]: string; }
{ "end_byte": 73, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileClassWithIndexSignature.ts" }
TypeScript/tests/cases/compiler/inferringReturnTypeFromConstructSignatureGeneric.ts_0_533
class GenericObject<T extends {} = {}> { give(value: T) { return value; } } class GenericNumber<T extends number> { give(value: T) { return value; } } class GenericNumberOrString<T extends number | string> { give(value: T) { return value; } } function g<T>(type: new () => T): T { return new...
{ "end_byte": 533, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferringReturnTypeFromConstructSignatureGeneric.ts" }
TypeScript/tests/cases/compiler/classIndexer3.ts_0_124
class C123 { [s: string]: number; constructor() { } } class D123 extends C123 { x: number; y: string; }
{ "end_byte": 124, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classIndexer3.ts" }
TypeScript/tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration.ts_0_417
//@module: amd // @Filename: ambientExternalModuleWithoutInternalImportDeclaration_0.ts declare module 'M' { module C { export var f: number; } class C { foo(): void; } export = C; } // @Filename: ambientExternalModuleWithoutInternalImportDeclaration_1.ts ///<reference path='ambien...
{ "end_byte": 417, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration.ts" }
TypeScript/tests/cases/compiler/commentsAfterSpread.ts_0_1036
// @target: ESNEXT const identity = (a) => a; const a = { .../*#__PURE__*/identity({ b: 1 }) }; const b = { ... /*#__PURE__*/identity({ b: 1 }) }; const c = { ... /*#__PURE__*/ identity({ b: 1 }) }; const d = { .../*#__PURE__*/ identity({ b: 1 }) }; function e (.../* comment...
{ "end_byte": 1036, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsAfterSpread.ts" }
TypeScript/tests/cases/compiler/inferenceDoesNotAddUndefinedOrNull.ts_0_984
// @strict: true interface NodeArray<T extends Node> extends ReadonlyArray<T> {} interface Node { forEachChild<T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined; } declare function toArray<T>(value: T | T[]): T[]; declare function toArray<T>(value: ...
{ "end_byte": 984, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferenceDoesNotAddUndefinedOrNull.ts" }
TypeScript/tests/cases/compiler/constEnumPreserveEmitNamedExport1.ts_0_167
// @preserveConstEnums: true // @target: esnext // @filename: a.ts const enum A { Foo }; export { A }; // @filename: b.ts import { A } from './a'; export { A };
{ "end_byte": 167, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constEnumPreserveEmitNamedExport1.ts" }
TypeScript/tests/cases/compiler/functionReturnTypeQuery.ts_0_166
declare let foo: number; declare function test1(foo: string, bar: typeof foo): typeof foo; declare function test2({foo}: {foo: string}, bar: typeof foo): typeof foo;
{ "end_byte": 166, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionReturnTypeQuery.ts" }
TypeScript/tests/cases/compiler/moduleResolutionAsTypeReferenceDirectiveAmbient.ts_0_394
// @noImplicitReferences: true // @typeRoots: /typings // @types: phaser // @traceResolution: true // @currentDirectory: / // @Filename: /typings/phaser/types/phaser.d.ts declare module "phaser" { export const a2: number; } // @Filename: /typings/phaser/package.json { "name": "phaser", "version": "1.2.3", "types"...
{ "end_byte": 394, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionAsTypeReferenceDirectiveAmbient.ts" }
TypeScript/tests/cases/compiler/varianceReferences.ts_0_1452
// @strict: true // @noEmit: true type NumericConstraint<Value extends number> = Value; type VarianceConstrainedNumber<in out Value extends number> = NumericConstraint<Value>; declare let vcn1: VarianceConstrainedNumber<1>; declare let vcn12: VarianceConstrainedNumber<1 | 2>; vcn1 = vcn12; vcn12 = vcn1; type Unc...
{ "end_byte": 1452, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/varianceReferences.ts" }
TypeScript/tests/cases/compiler/initializerWithThisPropertyAccess.ts_0_461
// @strict: true // @declaration: true class A { a: number; b = this.a; // Error c = () => this.a; d = (new A()).a; constructor() { this.a = 1; } } class B extends A { x = this.a; } class C { a!: number; b = this.a; } // Repro from #37979 class Foo { private bar: Ba...
{ "end_byte": 461, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/initializerWithThisPropertyAccess.ts" }
TypeScript/tests/cases/compiler/inferentialTypingUsingApparentType3.ts_0_461
interface Field<T> { clean(input: T): T } class CharField implements Field<string> { clean(input: string) { return "Yup"; } } class NumberField implements Field<number> { clean(input: number) { return 123; } } class ObjectField<A, T extends { [name: string]: Field<any> }> { co...
{ "end_byte": 461, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferentialTypingUsingApparentType3.ts" }
TypeScript/tests/cases/compiler/checkJsxNotSetError.ts_0_188
// @allowJs: true // @checkJs: true // @Filename: /foo.jsx const Foo = () => ( <div>foo</div> ); export default Foo; // @Filename: /bar.jsx import Foo from '/foo'; const a = <Foo />
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/checkJsxNotSetError.ts" }
TypeScript/tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.ts_0_1104
interface TextChannel { id: string; type: 'text'; phoneNumber: string; } interface EmailChannel { id: string; type: 'email'; addres: string; } type Channel = TextChannel | EmailChannel; export type ChannelType = Channel extends { type: infer R } ? R : never; type Omit<T, K extends keyof T> =...
{ "end_byte": 1104, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.ts" }
TypeScript/tests/cases/compiler/classBlockScoping.ts_0_383
function f(b: boolean) { let Foo: any; if (b) { Foo = class Foo { static y = new Foo(); static x() { new Foo(); } m() { new Foo(); } }; new Foo(); } else { class Foo { static y = new Foo(); static x() { new Foo(); } ...
{ "end_byte": 383, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classBlockScoping.ts" }
TypeScript/tests/cases/compiler/staticVisibility.ts_1_500
class C1 { p: any; static s: any; constructor() { var v = 0; s = 1; // should be error C1.s = 1; // should be ok b(); // should be error C1.b(); // should be ok } static b() { v = 1; // should be error this.p = 0; // should be error ...
{ "end_byte": 500, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/staticVisibility.ts" }
TypeScript/tests/cases/compiler/staticInitializersAndLegacyClassDecorators.ts_0_266
// @target: es2022 // @experimentalDecorators: true // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/52004 declare var dec: any; @dec class C1 { static instance = new C1(); } @dec class C2 { static { new C2(); } }
{ "end_byte": 266, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/staticInitializersAndLegacyClassDecorators.ts" }
TypeScript/tests/cases/compiler/strictNullLogicalAndOr.ts_0_246
// @strictNullChecks: true // Repro from #9113 let sinOrCos = Math.random() < .5; let choice = sinOrCos && Math.sin || Math.cos; choice(Math.PI); function sq(n?: number): number { const r = n !== undefined && n*n || 0; return r; } sq(3);
{ "end_byte": 246, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/strictNullLogicalAndOr.ts" }
TypeScript/tests/cases/compiler/tslibMultipleMissingHelper.ts_0_1181
// @filename: /tsconfig.json { "compilerOptions": { "strict": true, "target": "ES2016", "importHelpers": true, "module": "commonjs", } } // @filename: /package1/index.ts export {}; async function foo(): Promise<void> {} async function bar(): Promise<void> {} // @filename: /pack...
{ "end_byte": 1181, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/tslibMultipleMissingHelper.ts" }
TypeScript/tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts_0_122
export default interface A { a: string; } export default function() { return 1; } export default function() { return 2; }
{ "end_byte": 122, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts" }
TypeScript/tests/cases/compiler/downlevelLetConst6.ts_0_3
let
{ "end_byte": 3, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/downlevelLetConst6.ts" }
TypeScript/tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts_0_312
// @strict: true // Repro from #20196 type A = { a: (x: number) => string }; type B = { a: (x: boolean) => string }; function call0(p: A | B) { p.a("s"); // Error } function callN<T extends A | B>(p: T) { p.a("s"); // Error var a: T["a"] = p.a; a(""); // Error a("", "", "", ""); // Error }
{ "end_byte": 312, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts" }
TypeScript/tests/cases/compiler/semicolonsInModuleDeclarations.ts_0_132
declare module ambiModule { export interface i1 { }; export interface i2 { } } var n1: ambiModule.i1; var n2: ambiModule.i2;
{ "end_byte": 132, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/semicolonsInModuleDeclarations.ts" }
TypeScript/tests/cases/compiler/assignToEnum.ts_0_145
enum A { foo, bar } A = undefined; // invalid LHS A = A.bar; // invalid LHS A.foo = 1; // invalid LHS A.foo = A.bar; // invalid LHS
{ "end_byte": 145, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignToEnum.ts" }
TypeScript/tests/cases/compiler/constDeclarations-invalidContexts.ts_0_515
// @allowUnreachableCode: true // @target: ES6 // Errors, const must be defined inside a block if (true) const c1 = 0; else const c2 = 0; while (true) const c3 = 0; do const c4 = 0; while (true); var obj; with (obj) const c5 = 0; // No Error will be reported here since we turn off all typ...
{ "end_byte": 515, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constDeclarations-invalidContexts.ts" }
TypeScript/tests/cases/compiler/unusedLocalsAndParametersOverloadSignatures.ts_0_738
//@noUnusedLocals:true //@noUnusedParameters:true export function func(details: number, message: string, ...args: any[]): void; export function func(details: number, message: string): any { return details + message; } export class C { constructor(details: number, message: string, ...args: any[]); construc...
{ "end_byte": 738, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedLocalsAndParametersOverloadSignatures.ts" }
TypeScript/tests/cases/compiler/contextualReturnTypeOfIIFE.ts_0_303
// @lib: esnext const test1: Promise<[one: number, two: string]> = (async () => { return [1, 'two']; })(); const test2: Promise<[one: number, two: string]> = new Promise( (resolve) => resolve([1, 'two']), ); const obj: { foo: [one: number, two: string] } = { foo: (() => [1, 'two'])() };
{ "end_byte": 303, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualReturnTypeOfIIFE.ts" }
TypeScript/tests/cases/compiler/jsdocTypedefMissingType.ts_0_281
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /a.js // Bad: missing a type /** @typedef T */ const t = 0; // OK: missing a type, but have property tags. /** * @typedef Person * @property {string} name */ /** @type Person */ const person = { name: "" };
{ "end_byte": 281, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocTypedefMissingType.ts" }
TypeScript/tests/cases/compiler/constraintCheckInGenericBaseTypeReference.ts_0_305
// No errors class Constraint { public method() { } } class GenericBase<T extends Constraint> { public items: any; } class Derived extends GenericBase<TypeArg> { } class TypeArg { public method() { Container.People.items; } } class Container { public static People: Derived }
{ "end_byte": 305, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constraintCheckInGenericBaseTypeReference.ts" }
TypeScript/tests/cases/compiler/numericIndexerConstraint2.ts_0_89
class Foo { foo() { } } var x: { [index: string]: Foo; }; var a: { one: number; }; x = a;
{ "end_byte": 89, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/numericIndexerConstraint2.ts" }
TypeScript/tests/cases/compiler/inheritanceStaticFuncOverridingMethod.ts_0_122
class a { static x() { return "10"; } } class b extends a { static x() { return "20"; } }
{ "end_byte": 122, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritanceStaticFuncOverridingMethod.ts" }
TypeScript/tests/cases/compiler/jsxNestedWithinTernaryParsesCorrectly.tsx_0_263
// @jsx: preserve const emptyMessage = null as any; const a = ( <div> {0 ? ( emptyMessage // must be identifier? ) : ( // must be exactly two expression holes <span> {0}{0} </span> )} </div> );
{ "end_byte": 263, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxNestedWithinTernaryParsesCorrectly.tsx" }
TypeScript/tests/cases/compiler/redeclareParameterInCatchBlock.ts_0_253
// @target: es6 try { } catch(e) { const e = null; } try { } catch(e) { let e; } try { } catch ([a, b]) { const [c, b] = [0, 1]; } try { } catch ({ a: x, b: x }) { } try { } catch(e) { function test() { let e; } }
{ "end_byte": 253, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/redeclareParameterInCatchBlock.ts" }
TypeScript/tests/cases/compiler/protoAsIndexInIndexExpression.ts_0_411
// @module: commonjs // @Filename: protoAsIndexInIndexExpression_0.ts export var x; // @Filename: protoAsIndexInIndexExpression_1.ts ///<reference path='protoAsIndexInIndexExpression_0.ts'/> var EntityPrototype = undefined; var WorkspacePrototype = { serialize: function (): any { } }; WorkspacePrototype['__pro...
{ "end_byte": 411, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/protoAsIndexInIndexExpression.ts" }
TypeScript/tests/cases/compiler/dependencyViaImportAlias.ts_0_124
//@module: amd //@Filename: A.ts export class A { } //@Filename: B.ts import a = require('A'); import A = a.A; export = A;
{ "end_byte": 124, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/dependencyViaImportAlias.ts" }
TypeScript/tests/cases/compiler/constructorOverloads2.ts_0_476
class FooBase { constructor(s: string); constructor(n: number); constructor(x: any) { } bar1() { /*WScript.Echo("base bar1");*/ } } class Foo extends FooBase { constructor(s: string); constructor(n: number); constructor(a:any); constructor(x: any, y?: any) { super(x); }...
{ "end_byte": 476, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constructorOverloads2.ts" }
TypeScript/tests/cases/compiler/operatorAddNullUndefined.ts_0_409
enum E { x } var x1 = null + null; var x2 = null + undefined; var x3 = undefined + null; var x4 = undefined + undefined; var x5 = 1 + null; var x6 = 1 + undefined; var x7 = null + 1; var x8 = undefined + 1; var x9 = "test" + null; var x10 = "test" + undefined; var x11 = null + "test"; var x12 = undefined + "test"; var ...
{ "end_byte": 409, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/operatorAddNullUndefined.ts" }
TypeScript/tests/cases/compiler/omittedExpressionForOfLoop.ts_0_159
// @strict: true // @target: es2015 for (const [,] of doesNotExist) { } for (const [,] of undefined) { } for (const [,] of []) { } for (const [] of []) { }
{ "end_byte": 159, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/omittedExpressionForOfLoop.ts" }
TypeScript/tests/cases/compiler/optionalChainWithInstantiationExpression1.ts_0_213
// @target: es2019,es2020 declare namespace A { export class b<T> { static d: number; constructor(x: T); } } type c = unknown; declare const a: typeof A | undefined; a?.b<c>.d; a?.b.d
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/optionalChainWithInstantiationExpression1.ts" }
TypeScript/tests/cases/compiler/enumWithParenthesizedInitializer1.ts_0_19
enum E { e = -(3 }
{ "end_byte": 19, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumWithParenthesizedInitializer1.ts" }
TypeScript/tests/cases/compiler/neverAsDiscriminantType.ts_0_1494
// @strict: true, false type Foo1 = { kind: 'a', a: number } | { kind: 'b' } | { kind: never }; function f1(foo: Foo1) { if (foo.kind === 'a') { foo.a; } } type Foo2 = { kind?: 'a', a: number } | { kind?: 'b' } | { kind?: never }; function f2(foo: Foo2) { if (foo.kind === 'a') { foo.a; ...
{ "end_byte": 1494, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/neverAsDiscriminantType.ts" }
TypeScript/tests/cases/compiler/declarationFilesWithTypeReferences4.ts_0_218
// @declaration: true // @filename: /a/node_modules/@types/node/index.d.ts interface Error { stack2: string; } // @filename: /a/app.ts /// <reference types="node"/> function foo(): Error { return undefined; }
{ "end_byte": 218, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationFilesWithTypeReferences4.ts" }
TypeScript/tests/cases/compiler/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.ts_0_279
// @declaration: true // @filename: color.ts interface Color { c: string; } export default Color; // @filename: file1.ts import Color from "./color"; export declare function styled(): Color; // @filename: file2.ts import { styled } from "./file1"; export const A = styled();
{ "end_byte": 279, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.ts" }
TypeScript/tests/cases/compiler/octalLiteralAndEscapeSequence.ts_0_1004
00; 05; 000; 005; 055; `0${00}`; `0${05}`; `0${000}`; `0${005}`; `0${055}`; `${00}0`; `${05}0`; `${000}0`; `${005}0`; `${055}0`; "\0"; "\5"; "\00"; "\05"; "\55"; "\000"; "\005"; "\055"; '\0'; '\5'; '\00'; '\05'; '\55'; '\000'; '\005'; '\055'; "\1"; "\01"; "\001"; "\17"; "\017"; "\0017"; "\177"; "\18"; "\018"; "\0018"...
{ "end_byte": 1004, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/octalLiteralAndEscapeSequence.ts" }
TypeScript/tests/cases/compiler/errorOnUnionVsObjectShouldDeeplyDisambiguate.ts_0_678
interface Stuff { a?: () => Promise<number[]>; b: () => Promise<string>; c: () => Promise<string>; d: () => Promise<string>; e: () => Promise<string>; f: () => Promise<string>; g: () => Promise<string>; h: () => Promise<string>; i: () => Promise<string>; j: () => Promise<string>;...
{ "end_byte": 678, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/errorOnUnionVsObjectShouldDeeplyDisambiguate.ts" }
TypeScript/tests/cases/compiler/functionCall7.ts_0_145
module m1 { export class c1 { public a; }} function foo(a:m1.c1){ a.a = 1; }; var myC = new m1.c1(); foo(myC); foo(myC, myC); foo(4); foo();
{ "end_byte": 145, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionCall7.ts" }
TypeScript/tests/cases/compiler/moduleVisibilityTest4.ts_0_186
module M { export type nums = number; } namespace N { export type nums = number; } let a1: M.num; let b1: M.nums; let c1: M.bar; let a2: N.num; let b2: N.nums; let c2: N.bar;
{ "end_byte": 186, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleVisibilityTest4.ts" }
TypeScript/tests/cases/compiler/jsFileCompilationAwaitModifier.ts_0_226
// @declaration: true // @allowJs: true // @outDir: ./out // @lib: es2015 // @filename: a.js class Foo { async a() { await Promise.resolve(1); } b = async () => { await Promise.resolve(1); } }
{ "end_byte": 226, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationAwaitModifier.ts" }
TypeScript/tests/cases/compiler/templateLiteralsInTypes.ts_0_147
// @strict: true // @declaration: true const f = (hdr: string, val: number) => `${hdr}:\t${val}\r\n` as `${string}:\t${number}\r\n`; f("x").foo;
{ "end_byte": 147, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/templateLiteralsInTypes.ts" }
TypeScript/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.ts_0_672
// @module: amd // @declaration: true // @target: ES5 // @filename: server.ts export var a = 10; export var x = a; export var m = a; export default {}; // @filename: client.ts export import defaultBinding1, { } from "server"; export import defaultBinding2, { a } from "server"; export var x1: number = a; export import...
{ "end_byte": 672, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.ts" }
TypeScript/tests/cases/compiler/functionOnlyHasThrow.ts_0_66
function clone():number { throw new Error("To be implemented"); }
{ "end_byte": 66, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOnlyHasThrow.ts" }
TypeScript/tests/cases/compiler/functionOverloads1.ts_0_57
function foo(); 1+1; function foo():string { return "a" }
{ "end_byte": 57, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads1.ts" }
TypeScript/tests/cases/compiler/metadataOfClassFromAlias2.ts_0_396
// @experimentalDecorators: true // @emitDecoratorMetadata: true // @target: es5 // @module: commonjs // @filename: auxiliry.ts export class SomeClass { field: string; } //@filename: test.ts import { SomeClass } from './auxiliry'; function annotation(): PropertyDecorator { return (target: any): void => { }; }...
{ "end_byte": 396, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/metadataOfClassFromAlias2.ts" }
TypeScript/tests/cases/compiler/indexedAccessNormalization.ts_0_491
// @strict: true // Repro from from #43152 type MyMap<M extends object> = { [K in keyof M]: { x: number } } declare function g<T>(value?: T): void; function f1<M extends object>(mymap: MyMap<M>, k: keyof M) { const elemofM = mymap[k]; g(elemofM); } function f2<M extends object>(mymap: MyMap...
{ "end_byte": 491, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexedAccessNormalization.ts" }
TypeScript/tests/cases/compiler/promiseChaining2.ts_0_423
// same example but with constraints on each type parameter class Chain2<T extends { length: number }> { constructor(public value: T) { } then<S extends Function>(cb: (x: T) => S): Chain2<S> { var result = cb(this.value); // should get a fresh type parameter which each then call var z = ...
{ "end_byte": 423, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/promiseChaining2.ts" }
TypeScript/tests/cases/compiler/enumIndexer.ts_0_192
enum MyEnumType { foo, bar } var _arr = [{ key: 'foo' }, { key: 'bar' }] var enumValue = MyEnumType.foo; var x = _arr.map(o => MyEnumType[o.key] === enumValue); // these are not same type
{ "end_byte": 192, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumIndexer.ts" }
TypeScript/tests/cases/compiler/outModuleConcatCommonjsDeclarationOnly.ts_0_248
// @target: ES5 // @sourcemap: true // @declaration: true // @emitDeclarationOnly: true // @module: commonjs // @outFile: all.js // @Filename: ref/a.ts export class A { } // @Filename: b.ts import {A} from "./ref/a"; export class B extends A { }
{ "end_byte": 248, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/outModuleConcatCommonjsDeclarationOnly.ts" }
TypeScript/tests/cases/compiler/declFileExportImportChain2.ts_0_515
//@module: amd //@declaration: true // @Filename: declFileExportImportChain2_a.ts module m1 { export module m2 { export class c1 { } } } export = m1; // @Filename: declFileExportImportChain2_b.ts import a = require("declFileExportImportChain2_a"); export = a; // @Filename: declFileExportImpor...
{ "end_byte": 515, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileExportImportChain2.ts" }
TypeScript/tests/cases/compiler/assignmentCompatability17.ts_0_345
module __test1__ { export interface interfaceWithPublicAndOptional<T,U> { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional<number,string> = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { export var obj = {two: <any[]>[1]}; export var __val__obj = obj; } __test2__.__val__ob...
{ "end_byte": 345, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability17.ts" }
TypeScript/tests/cases/compiler/emitDecoratorMetadata_restArgs.ts_0_422
// @experimentaldecorators: true // @emitdecoratormetadata: true // @target: ES5 declare const MyClassDecorator: ClassDecorator; declare const MyMethodDecorator: MethodDecorator; @MyClassDecorator class A { constructor(...args) {} @MyMethodDecorator method(...args) {} } @MyClassDecorator class B { co...
{ "end_byte": 422, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emitDecoratorMetadata_restArgs.ts" }
TypeScript/tests/cases/compiler/typeMatch2.ts_0_905
function f1() { var a = { x: 1, y: 2 }; a = {}; // error a = { x: 1 }; // error a = { x: 1, y: 2, z: 3 }; a = { x: 1, z: 3 }; // error } class Animal { private a; } class Giraffe extends Animal { private g; } function f2() { var a = new Animal(); var g = new Giraffe(); var aa = [ a, a, a ]; ...
{ "end_byte": 905, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeMatch2.ts" }
TypeScript/tests/cases/compiler/classExtendsNull3.ts_0_160
// @strict: true // @noEmit: true class C1 extends null { static method() { super.oops; } } class C2 extends null { method() { super.oops; } }
{ "end_byte": 160, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExtendsNull3.ts" }
TypeScript/tests/cases/compiler/keywordInJsxIdentifier.tsx_0_109
//@jsx: react declare var React: any; <foo class-id/>; <foo class/>; <foo class-id="1"/>; <foo class="1"/>;
{ "end_byte": 109, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/keywordInJsxIdentifier.tsx" }
TypeScript/tests/cases/compiler/duplicateVarAndImport2.ts_0_89
// error since module is instantiated var a; module M { export var x = 1; } import a = M;
{ "end_byte": 89, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/duplicateVarAndImport2.ts" }
TypeScript/tests/cases/compiler/preserveConstEnums.ts_0_75
// @preserveConstEnums: true const enum E { Value = 1, Value2 = Value }
{ "end_byte": 75, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/preserveConstEnums.ts" }
TypeScript/tests/cases/compiler/conflictingTypeParameterSymbolTransfer.ts_0_578
// @strict // Via #56620 class Base<U> { } export class C2<T> extends Base<unknown> { T: number; constructor(T: number) { super(); // Should not error this.T = T; // Should error let a: U = null; } } // via #56689 class Leg { } class Foo<t> extends Leg { t = {}...
{ "end_byte": 578, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conflictingTypeParameterSymbolTransfer.ts" }
TypeScript/tests/cases/compiler/detachedCommentAtStartOfConstructor1.ts_0_288
class TestFile { public message: string; public name; constructor(message: string) { /// <summary>Test summary</summary> /// <param name="message" type="String" /> var getMessage = () => message + this.name; this.message = getMessage(); } }
{ "end_byte": 288, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/detachedCommentAtStartOfConstructor1.ts" }
TypeScript/tests/cases/compiler/functionOverloads39.ts_0_153
function foo(bar:{a:number;}[]):string; function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo([{a:true}]);
{ "end_byte": 153, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads39.ts" }
TypeScript/tests/cases/compiler/genericDerivedTypeWithSpecializedBase.ts_0_123
class A<T> { x: T; } class B<U> extends A<string> { y: U; } var x: A<number>; var y: B<number>; x = y; // error
{ "end_byte": 123, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericDerivedTypeWithSpecializedBase.ts" }
TypeScript/tests/cases/compiler/overloadsWithProvisionalErrors.ts_0_479
var func: { (s: string): number; (lambda: (s: string) => { a: number; b: number }): string; }; func(s => ({})); // Error for no applicable overload (object type is missing a and b) func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the pr...
{ "end_byte": 479, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadsWithProvisionalErrors.ts" }
TypeScript/tests/cases/compiler/unusedSetterInClass.ts_0_200
//@target: ES5 //@noUnusedLocals:true //@noUnusedParameters:true class Employee { private _fullName: string; private set fullName(newName: string) { this._fullName = newName; } }
{ "end_byte": 200, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedSetterInClass.ts" }
TypeScript/tests/cases/compiler/assignmentCompatability46.ts_0_71
declare function fn(x: never): void; fn([1, 2, 3]) fn({ a: 1, b: 2 })
{ "end_byte": 71, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability46.ts" }
TypeScript/tests/cases/compiler/i3.ts_0_80
interface I3 { one?: number; }; var x: {one: number}; var i: I3; i = x; x = i;
{ "end_byte": 80, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/i3.ts" }
TypeScript/tests/cases/compiler/parametersSyntaxErrorNoCrash2.ts_0_173
// @strict: true // @noEmit: true // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/59353 export default function getThing( { return 'thing'; }
{ "end_byte": 173, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parametersSyntaxErrorNoCrash2.ts" }
TypeScript/tests/cases/compiler/jsxCallElaborationCheckNoCrash1.tsx_0_266
// @jsx: react /// <reference path="/.lib/react16.d.ts" /> import * as React from "react"; type Tags = "span" | "div"; export const Hoc = <Tag extends Tags>( TagElement: Tag, ): React.SFC => { const Component = () => <TagElement />; return Component; };
{ "end_byte": 266, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxCallElaborationCheckNoCrash1.tsx" }
TypeScript/tests/cases/compiler/uncalledFunctionChecksInConditionalPerf.ts_0_235
// @strictNullChecks: true declare const b: boolean; ((((((((((((((((((((((((((b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b);
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/uncalledFunctionChecksInConditionalPerf.ts" }
TypeScript/tests/cases/compiler/jsEmitIntersectionProperty.ts_0_841
// #37015 - test asserts lack of crash // @allowJs: true // @checkJs: true // @declaration: true // @emitDeclarationOnly: true // @incremental: true // @tsBuildInfoFile: .tsbuildinfo // @noTypesAndSymbols: true // @Filename: globals.d.ts declare class CoreObject { static extend< Statics, Instance extends B...
{ "end_byte": 841, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsEmitIntersectionProperty.ts" }
TypeScript/tests/cases/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.tsx_0_577
// @allowJs: true // @checkJs: true // @emitDeclarationOnly: true // @declaration: true // @strict: true // @esModuleInterop: true // @jsx: react // @noImplicitAny: false // @filename: jsxDeclarationsWithEsModuleInteropNoCrash.jsx /// <reference path="/.lib/react16.d.ts" preserve="true" /> import PropTypes from 'prop-t...
{ "end_byte": 577, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.tsx" }
TypeScript/tests/cases/compiler/jsxNamespacePrefixInName.tsx_0_1211
// @jsx: preserve var justElement1 = <a:element />; var justElement2 = <a:element></a:element>; var justElement3 = <a:element attr={"value"}></a:element>; var justElement4 = <a:element>{"text"}</a:element>; var justElement5 = <a:element attr={"value"}>{"text"}</a:element>; var tooManySeparators1 = <a:ele:ment />; var...
{ "end_byte": 1211, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxNamespacePrefixInName.tsx" }
TypeScript/tests/cases/compiler/commentsdoNotEmitComments.ts_0_1642
// @target: ES5 // @declaration: true // @removeComments: true /** Variable comments*/ var myVariable = 10; /** function comments*/ function foo(/** parameter comment*/p: number) { } /** variable with function type comment*/ var fooVar: () => void; foo(50); fooVar(); /**class comment*/ class c { /** constructor...
{ "end_byte": 1642, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsdoNotEmitComments.ts" }
TypeScript/tests/cases/compiler/internalAliasVarInsideTopLevelModuleWithExport.ts_0_126
//@module: amd // @declaration: true export module a { export var x = 10; } export import b = a.x; export var bVal = b;
{ "end_byte": 126, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasVarInsideTopLevelModuleWithExport.ts" }
TypeScript/tests/cases/compiler/amdDependencyCommentName1.ts_0_95
//@module: commonjs ///<amd-dependency path='bar' name='b'/> import m1 = require("m2") m1.f();
{ "end_byte": 95, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/amdDependencyCommentName1.ts" }
TypeScript/tests/cases/compiler/omitTypeTestErrors01.ts_0_277
// @declaration: true interface Foo { a: string; b: number; c: boolean; } export type Bar = Omit<Foo, "c">; export type Baz = Omit<Foo, "b" | "c">; export function getBarC(bar: Bar) { return bar.c; } export function getBazB(baz: Baz) { return baz.b; }
{ "end_byte": 277, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/omitTypeTestErrors01.ts" }
TypeScript/tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts_0_120
module A { export interface X { s: string } export var a = 10; } module B { var A = 1; import Y = A; }
{ "end_byte": 120, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts" }
TypeScript/tests/cases/compiler/nestedBlockScopedBindings10.ts_0_98
{ let x; x = 1; } switch (1) { case 1: let y; y = 1; break; }
{ "end_byte": 98, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedBlockScopedBindings10.ts" }
TypeScript/tests/cases/compiler/downlevelLetConst16.ts_0_3049
// @target:es5 // @allowUnreachableCode: true 'use strict' declare function use(a: any); var x = 10; var y; var z; use(x); use(y); use(z); function foo1() { let x = 1; use(x); let [y] = [1]; use(y); let {a: z} = {a: 1}; use(z); } function foo2() { { let x = 1; use(x); ...
{ "end_byte": 3049, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/downlevelLetConst16.ts" }
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts_0_1054
// @module: commonjs // @traceResolution: true // @filename: c:/root/src/tsconfig.json { "compilerOptions": { "baseUrl": "../", "paths": { "*": [ "*", "c:/shared/*" ], "templates/*": [ "generated/src/templates/*" ...
{ "end_byte": 1054, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts" }
TypeScript/tests/cases/compiler/jsdocAccessEnumType.ts_0_172
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /a.ts export enum E { A } // @Filename: /b.js import { E } from "./a"; /** @type {E} */ const e = E.A;
{ "end_byte": 172, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocAccessEnumType.ts" }
TypeScript/tests/cases/compiler/inheritanceMemberPropertyOverridingMethod.ts_0_92
class a { x() { return "20"; } } class b extends a { x: () => string; }
{ "end_byte": 92, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritanceMemberPropertyOverridingMethod.ts" }
TypeScript/tests/cases/compiler/shebangBeforeReferences.ts_0_231
// @module: commonjs // @filename: f.d.ts declare module "test" { let x: number; } // @filename: f.ts #!/usr/bin/env node /// <reference path="f.d.ts"/> declare function use(f: number): void; import {x} from "test"; use(x);
{ "end_byte": 231, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/shebangBeforeReferences.ts" }
TypeScript/tests/cases/compiler/augmentArray.ts_0_37
interface Array<T> { (): any[]; }
{ "end_byte": 37, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/augmentArray.ts" }
TypeScript/tests/cases/compiler/separate1-1.ts_0_6
X.f();
{ "end_byte": 6, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/separate1-1.ts" }
TypeScript/tests/cases/compiler/topLevelLambda2.ts_0_45
function foo(x:any) {} foo(()=>this.window);
{ "end_byte": 45, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/topLevelLambda2.ts" }
TypeScript/tests/cases/compiler/yieldStarContextualType.ts_0_203
// @target: esnext // @noEmit: true declare const g: <T, U, V>() => Generator<T, U, V>; function* f(): Generator<string, void, unknown> { const x1 = yield* g(); const x2: number = yield* g(); }
{ "end_byte": 203, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/yieldStarContextualType.ts" }
TypeScript/tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions3.ts_3_148
@target: es6 function f(x: TemplateStringsArray, y: string, z: string) { } // Incomplete call, not enough parameters. f `123qdawdrqw${ 1 }${
{ "end_byte": 148, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions3.ts" }
TypeScript/tests/cases/compiler/formatToPartsFractionalSecond.ts_0_108
// @target: esnext new Intl.DateTimeFormat().formatToParts().find((val) => val.type === 'fractionalSecond')
{ "end_byte": 108, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/formatToPartsFractionalSecond.ts" }
TypeScript/tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts_0_220
//@module: amd export module a { export module b { export interface I { foo(); } } } export module c { import b = a.b; export var x: b.I; x.foo(); } export var z: c.b.I;
{ "end_byte": 220, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts" }
TypeScript/tests/cases/compiler/unqualifiedCallToClassStatic1.ts_0_104
class Vector { static foo = () => { // 'foo' cannot be called in an unqualified manner. foo(); } }
{ "end_byte": 104, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unqualifiedCallToClassStatic1.ts" }