_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/compiler/newAbstractInstance.ts_0_50
abstract class B { } declare const b: B; new b();
{ "end_byte": 50, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/newAbstractInstance.ts" }
TypeScript/tests/cases/compiler/copyrightWithoutNewLine1.ts_0_253
// @module: amd /***************************** * (c) Copyright - Important ****************************/ import model = require("./greeter") var el = document.getElementById('content'); var greeter = new model.Greeter(el); /** things */ greeter.start();
{ "end_byte": 253, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/copyrightWithoutNewLine1.ts" }
TypeScript/tests/cases/compiler/letAsIdentifier.ts_0_65
// @declaration: true var let = 10; var a = 10; let = 30; let a;
{ "end_byte": 65, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/letAsIdentifier.ts" }
TypeScript/tests/cases/compiler/accessorsEmit.ts_0_191
class Result { } class Test { get Property(): Result { var x = 1; return null; } } class Test2 { get Property() { var x = 1; return null; } }
{ "end_byte": 191, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/accessorsEmit.ts" }
TypeScript/tests/cases/compiler/ambientModuleExports.ts_0_254
declare module Foo { function a():void; var b:number; class C {} } Foo.a(); Foo.b; var c = new Foo.C(); declare module Foo2 { export function a(): void; export var b: number; export class C { } } Foo2.a(); Foo2.b; var c2 = new Foo2.C();
{ "end_byte": 254, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientModuleExports.ts" }
TypeScript/tests/cases/compiler/downlevelLetConst3.ts_0_11
const a = 1
{ "end_byte": 11, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/downlevelLetConst3.ts" }
TypeScript/tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts_0_390
// @module: system // @isolatedModules: true export class TopLevelClass {} export module TopLevelModule {var v;} export function TopLevelFunction(): void {} export enum TopLevelEnum {E} export module TopLevelModule2 { export class NonTopLevelClass {} export module NonTopLevelModule {var v;} export functio...
{ "end_byte": 390, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts" }
TypeScript/tests/cases/compiler/conditionalDoesntLeakUninstantiatedTypeParameter.ts_0_462
interface Synthetic<A, B extends A> {} type SyntheticDestination<T, U> = U extends Synthetic<T, infer V> ? V : never; type TestSynthetic = // Resolved to T, should be `number` or an inference failure (`unknown`) SyntheticDestination<number, Synthetic<number, number>>; const y: TestSynthetic = 3; // Type '3' is not...
{ "end_byte": 462, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionalDoesntLeakUninstantiatedTypeParameter.ts" }
TypeScript/tests/cases/compiler/isolatedModulesRequiresPreserveConstEnum.ts_0_114
// @isolatedModules: true // @preserveConstEnums: false // @module: commonjs // @filename: file1.ts export {};
{ "end_byte": 114, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesRequiresPreserveConstEnum.ts" }
TypeScript/tests/cases/compiler/duplicateIdentifierRelatedSpans5.ts_0_393
// @pretty: true // @filename: file1.ts declare global { interface TopLevel { duplicate1: () => string; duplicate2: () => string; duplicate3: () => string; } } export {} // @filename: file2.ts import "./file1"; declare global { interface TopLevel { duplicate1(): number; ...
{ "end_byte": 393, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/duplicateIdentifierRelatedSpans5.ts" }
TypeScript/tests/cases/compiler/declarationEmitPromise.ts_0_974
// @declaration: true // @module: commonjs // @target: es6 export class bluebird<T> { static all: Array<bluebird<any>>; } export async function runSampleWorks<A, B, C, D, E>( a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) { let result = await (bluebird.all as any)([a, ...
{ "end_byte": 974, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitPromise.ts" }
TypeScript/tests/cases/compiler/spellingSuggestionJSXAttribute.tsx_0_442
// @jsx: react /// <reference path="/.lib/react16.d.ts" /> import * as React from "react"; function MyComp2(props: { className?: string, htmlFor?: string }) { return null!; } class MyComp extends React.Component<{ className?: string, htmlFor?: string }> { } <a class="" />; <a for="" />; // should have no fix <labe...
{ "end_byte": 442, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spellingSuggestionJSXAttribute.tsx" }
TypeScript/tests/cases/compiler/jsxContainsOnlyTriviaWhiteSpacesNotCountedAsChild.tsx_0_343
// @jsx: preserve // @strict: true namespace JSX { export interface ElementChildrenAttribute { children: {}; } } interface Props { className?: string | undefined; } function NoticeList(props: Props) { return null; } <NoticeList className="my-notice-list"> </NoticeList>; <NoticeList className="my-notice...
{ "end_byte": 343, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxContainsOnlyTriviaWhiteSpacesNotCountedAsChild.tsx" }
TypeScript/tests/cases/compiler/classExpressionWithStaticPropertiesES64.ts_0_43
// @target: es6 (class { static x = 0; });
{ "end_byte": 43, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExpressionWithStaticPropertiesES64.ts" }
TypeScript/tests/cases/compiler/declarationEmitPrivateNameCausesError.ts_0_357
// @declaration: true // @lib: es6 // @filename: file.ts const IGNORE_EXTRA_VARIABLES = Symbol(); //Notice how this is unexported //This is exported export function ignoreExtraVariables<CtorT extends {new(...args:any[]):{}}> (ctor : CtorT) { return class extends ctor { [IGNORE_EXTRA_VARIABLES] = true; //An...
{ "end_byte": 357, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitPrivateNameCausesError.ts" }
TypeScript/tests/cases/compiler/unwitnessedTypeParameterVariance.ts_0_387
// @strict: true // Repros from #33872 export interface CalcObj<O> { read: (origin: O) => CalcValue<O>; } export type CalcValue<O> = CalcObj<O>; function foo<O>() { const unk: CalcObj<unknown> = { read: (origin: unknown) => unk } const x: CalcObj<O> = unk; } type A<T> = B<T>; interface B<T> { prop...
{ "end_byte": 387, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unwitnessedTypeParameterVariance.ts" }
TypeScript/tests/cases/compiler/constEnumBadPropertyNames.ts_0_33
const enum E { A } var x = E["B"]
{ "end_byte": 33, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constEnumBadPropertyNames.ts" }
TypeScript/tests/cases/compiler/asiBreak.ts_3_21
ile (true) break
{ "end_byte": 21, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/asiBreak.ts" }
TypeScript/tests/cases/compiler/inlineSources.ts_0_174
// @target: ES5 // @sourcemap: true // @inlinesources: true // @outFile: out.js // @filename: a.ts var a = 0; console.log(a); // @filename: b.ts var b = 0; console.log(b);
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inlineSources.ts" }
TypeScript/tests/cases/compiler/nestedBlockScopedBindings6.ts_0_1183
function a0() { for (let x of [1]) { x = x + 1; } for (let x;;) { x = x + 2; } } function a1() { for (let x of [1]) { x = x + 1; () => x; } for (let x;;) { x = x + 2; } } function a2() { for (let x of [1]) { x = x + 1; } for (...
{ "end_byte": 1183, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedBlockScopedBindings6.ts" }
TypeScript/tests/cases/compiler/importHelpersInAmbientContext.ts_0_1418
// @importHelpers: true // @target: es5 // @filename: a.d.ts export { }; // Extends declare class C { } declare class D extends C { } // Destructuring interface I { ({descendants, read}?: { descendants?: boolean; read?: any; }): any; } // Object Rest interface Foo { a: number; b: string...
{ "end_byte": 1418, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersInAmbientContext.ts" }
TypeScript/tests/cases/compiler/es5SetterparameterDestructuringNotElided.ts_0_117
// @target: es5 const foo = { set foo([start, end]: [any, any]) { void start; void end; }, };
{ "end_byte": 117, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5SetterparameterDestructuringNotElided.ts" }
TypeScript/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts_3_99
@sourceMap: true module Q { function P() { // Test this var a = 1; } }
{ "end_byte": 99, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts" }
TypeScript/tests/cases/compiler/superCallFromClassThatDerivesFromGenericType2.ts_0_112
declare class B<T> { m<U>(): B<U>; } class D extends B<any> { constructor() { super(); } }
{ "end_byte": 112, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superCallFromClassThatDerivesFromGenericType2.ts" }
TypeScript/tests/cases/compiler/es5-umd3.ts_0_183
// @target: ES5 // @sourcemap: false // @declaration: false // @module: umd export default class A { constructor () { } public B() { return 42; } }
{ "end_byte": 183, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-umd3.ts" }
TypeScript/tests/cases/compiler/capturedLetConstInLoop10_ES6.ts_0_939
// @target: ES6 class A { foo() { for (let x of [0]) { let f = function() { return x; }; this.bar(f()); } } bar(a: number) { } baz() { for (let x of [1]) { let a = function() { return x; }; for (let y of [1]) { ...
{ "end_byte": 939, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop10_ES6.ts" }
TypeScript/tests/cases/compiler/autoTypeAssignedUsingDestructuringFromNeverNoCrash.ts_0_213
// @strict: true // @noEmit: true // https://github.com/microsoft/TypeScript/issues/57582 declare const b: null; let file; if (b === null) { // empty } else { [file] = b; } file; // request flow type here
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/autoTypeAssignedUsingDestructuringFromNeverNoCrash.ts" }
TypeScript/tests/cases/compiler/inheritanceMemberPropertyOverridingAccessor.ts_0_198
class a { private __x: () => string; get x() { return this.__x; } set x(aValue: () => string) { this.__x = aValue; } } class b extends a { x: () => string; }
{ "end_byte": 198, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritanceMemberPropertyOverridingAccessor.ts" }
TypeScript/tests/cases/compiler/indirectGlobalSymbolPartOfObjectType.ts_0_81
// @target: es6 export { } const Symbol = globalThis.Symbol; [][Symbol.iterator];
{ "end_byte": 81, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indirectGlobalSymbolPartOfObjectType.ts" }
TypeScript/tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts_0_257
// @declaration: true // @filename: file1.ts export class Foo {} // @filename: file2.ts export function foo(): import("./file1").Foo { return null as any; } // @filename: file3.ts import {foo} from "./file2"; export function bar() { return foo(); }
{ "end_byte": 257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts" }
TypeScript/tests/cases/compiler/reactNamespaceInvalidInput.tsx_0_60
//@jsx: react //@reactNamespace: my-React-Lib <foo data/>;
{ "end_byte": 60, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reactNamespaceInvalidInput.tsx" }
TypeScript/tests/cases/compiler/spreadOfObjectLiteralAssignableToIndexSignature.ts_0_746
// @strict: true const foo: Record<never, never> = {} // OK interface RecordOfRecords extends Record<keyof any, RecordOfRecords> {} const recordOfRecords: RecordOfRecords = {} recordOfRecords.propA = {...(foo !== undefined ? {foo} : {})} // OK recordOfRecords.propB = {...(foo && {foo})} // OK recordOfRecords.propC = {...
{ "end_byte": 746, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spreadOfObjectLiteralAssignableToIndexSignature.ts" }
TypeScript/tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx_0_145
//@jsx: react //@jsxFactory: h //@jsxFragmentFactory: null declare var h: any; <></>; <><span>1</span><><span>2.1</span><span>2.2</span></></>;
{ "end_byte": 145, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx" }
TypeScript/tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts_0_2289
// @strict: true declare class Component<P> { constructor(props: Readonly<P>); constructor(props: P, context?: any); readonly props: Readonly<P> & Readonly<{ children?: {} }>; } interface ComponentClass<P = {}> { new (props: P, context?: any): Component<P>; propTypes?: WeakValidationMap<P>; defa...
{ "end_byte": 2289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts" }
TypeScript/tests/cases/compiler/nodeNextImportModeImplicitIndexResolution.ts_0_754
// @module: nodenext // @filename: node_modules/pkg/package.json { "name": "pkg", "version": "0.0.1" } // @filename: node_modules/pkg/index.d.ts export const item = 4; // @filename: pkg/package.json { "private": true } // @filename: pkg/index.d.ts export const item = 4; // @filename: package.json { "typ...
{ "end_byte": 754, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nodeNextImportModeImplicitIndexResolution.ts" }
TypeScript/tests/cases/compiler/classSideInheritance1.ts_0_285
class A { static bar(): string { return ""; } foo(): number { return 1; } } class C2 extends A {} var a: A; var c: C2; a.bar(); // static off an instance - should be an error c.bar(); // static off an instance - should be an error A.bar(); // valid C2.bar(); // valid
{ "end_byte": 285, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classSideInheritance1.ts" }
TypeScript/tests/cases/compiler/moduleResolutionWithSuffixes_oneBlank.ts_0_322
// moduleSuffixes has one blank entry. Normal module resolution should occur. // @filename: /tsconfig.json { "compilerOptions": { "moduleResolution": "node", "traceResolution": true, "moduleSuffixes": [""] } } // @filename: /index.ts import { base } from "./foo"; // @filename: /foo.ts export function base() {...
{ "end_byte": 322, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionWithSuffixes_oneBlank.ts" }
TypeScript/tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty12.ts_0_160
// @strict: true enum E { A = "A", B = "B" } declare const m: { [K in E]: string | null }; if (m[E.A] !== null) { m[E.A].toString(); // string }
{ "end_byte": 160, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty12.ts" }
TypeScript/tests/cases/compiler/destructuringAssignmentWithStrictNullChecks.ts_0_59
// @strictNullChecks: true let bar: {}; ({ ...bar } = {});
{ "end_byte": 59, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructuringAssignmentWithStrictNullChecks.ts" }
TypeScript/tests/cases/compiler/typecheckIfCondition.ts_0_175
// both uses of module should be an undefined symbol function myWrapper() { if (!module.exports) module.exports = ""; var x = null; // don't want to baseline output }
{ "end_byte": 175, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typecheckIfCondition.ts" }
TypeScript/tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts_0_184
//@noUnusedLocals:true //@noUnusedParameters:true class Dummy { public greeter(person: string, person2: string) { var unused = 20; person2 = "dummy value"; } }
{ "end_byte": 184, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts" }
TypeScript/tests/cases/compiler/forwardDeclaredCommonTypes01.ts_0_320
// @lib: es5 // @target: es5 interface Promise<T> {} interface Symbol {} interface Map<K, V> {} interface WeakMap<K extends object, V> {} interface Set<T> {} interface WeakSet<T extends object> {} (function() { new Promise; new Symbol; Symbol(); new Map; new WeakMap; new Set; new WeakSet; });
{ "end_byte": 320, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/forwardDeclaredCommonTypes01.ts" }
TypeScript/tests/cases/compiler/enumNumbering1.ts_0_114
enum Test { A, B, C = Math.floor(Math.random() * 1000), D = 10, E // Error but shouldn't be }
{ "end_byte": 114, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumNumbering1.ts" }
TypeScript/tests/cases/compiler/declareModifierOnTypeAlias.ts_3_72
clare type Foo = string; type Bar = number; declare type Baz = Bar;
{ "end_byte": 72, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declareModifierOnTypeAlias.ts" }
TypeScript/tests/cases/compiler/allowSyntheticDefaultImports8.ts_0_206
// @allowSyntheticDefaultImports: false // @module: system // @Filename: b.d.ts export function foo(); export function bar(); // @Filename: a.ts import { default as Foo } from "./b"; Foo.bar(); Foo.foo();
{ "end_byte": 206, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/allowSyntheticDefaultImports8.ts" }
TypeScript/tests/cases/compiler/iteratorExtraParameters.ts_0_334
// @target: esnext // @noEmit: true // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/57130 const iter = { *[Symbol.iterator](_: number) { yield 0; } }; declare function g(...args: any): any; function* f() { for (const _ of iter); yield* iter; [...iter] ...
{ "end_byte": 334, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/iteratorExtraParameters.ts" }
TypeScript/tests/cases/compiler/contextualTypeOnYield1.ts_0_255
// @strict: true // @target: ES6 type FuncOrGeneratorFunc = () => (number | Generator<(arg: number) => void, any, void>) const f: FuncOrGeneratorFunc = function*() { yield (num) => console.log(num); // `num` should be inferred to have type `number`. }
{ "end_byte": 255, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTypeOnYield1.ts" }
TypeScript/tests/cases/compiler/jsxViaImport.tsx_0_513
//@jsx: preserve //@module: commonjs //@filename: component.d.ts declare module JSX { interface ElementAttributesProperty { props; } } declare module React { class Component<T, U> { } } declare module "BaseComponent" { var base: React.Component<any, {}>; export = base; } //@filename: consumer.tsx /// <ref...
{ "end_byte": 513, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxViaImport.tsx" }
TypeScript/tests/cases/compiler/es5-asyncFunctionObjectLiterals.ts_0_716
// @lib: es5,es2015.promise // @noEmitHelpers: true // @target: ES5 declare var x, y, z, a, b, c; async function objectLiteral0() { x = { a: await y, b: z }; } async function objectLiteral1() { x = { a: y, b: await z }; } async function objectLiteral2() { x = { ...
{ "end_byte": 716, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-asyncFunctionObjectLiterals.ts" }
TypeScript/tests/cases/compiler/objectSpreadWithinMethodWithinObjectWithSpread.ts_0_136
const obj = {}; const a = { ...obj, prop() { return { ...obj, metadata: 213 }; } };
{ "end_byte": 136, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectSpreadWithinMethodWithinObjectWithSpread.ts" }
TypeScript/tests/cases/compiler/interfaceInheritance.ts_0_580
interface I1 { i1P1: number; i1P2(): void; } interface I2 extends I1 { i2P1: string; } interface I3 { i2P1: string; // has a member from i2P1, but not from I1 } interface I4 { one: number; } interface I5 { one: string; } class C1 implements I2 { // should be an error - it doesn't implement the me...
{ "end_byte": 580, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/interfaceInheritance.ts" }
TypeScript/tests/cases/compiler/spreadsAndContextualTupleTypes.ts_0_1656
// @strict: true // @noEmit: true declare function fx1<T extends [string, string, string, 'a' | 'b']>(x: T): T; declare function fx2<T extends [...string[], 'a' | 'b']>(x: T): T; const t3 = ['x', 'y', 'z'] as const; fx1(['x', 'y', 'z', 'a']); fx1([...t3, 'a']); fx2(['x', 'y', 'z', 'a']); fx2([...t3, 'a']); const x...
{ "end_byte": 1656, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spreadsAndContextualTupleTypes.ts" }
TypeScript/tests/cases/compiler/unexpectedStatementBlockTerminator.ts_0_68
class Foo {} class Bar {} case function Goo() {return {a:1,b:2};}
{ "end_byte": 68, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unexpectedStatementBlockTerminator.ts" }
TypeScript/tests/cases/compiler/functionWithDefaultParameterWithNoStatements5.ts_0_48
function foo(a = 0) { } function bar(a = 0) { }
{ "end_byte": 48, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionWithDefaultParameterWithNoStatements5.ts" }
TypeScript/tests/cases/compiler/declarationEmitNameConflictsWithAlias.ts_0_249
// @declaration: true // @module: commonjs export module C { export interface I { } } export import v = C; export module M { export module C { export interface I { } } export var w: v.I; // Gets emitted as C.I, which is the wrong interface }
{ "end_byte": 249, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitNameConflictsWithAlias.ts" }
TypeScript/tests/cases/compiler/unusedInterfaceinNamespace3.ts_0_173
//@noUnusedLocals:true //@noUnusedParameters:true namespace Validation { interface i1 { } export interface i2 { } interface i3 extends i1 { } }
{ "end_byte": 173, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedInterfaceinNamespace3.ts" }
TypeScript/tests/cases/compiler/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.ts_0_109
// @declaration: true // @lib: es6 const key = Symbol(), value = 12; export class Foo { [key] = value; }
{ "end_byte": 109, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.ts" }
TypeScript/tests/cases/compiler/propertiesAndIndexers.ts_0_581
interface X { } interface Y { n: number; } interface Z { s: string; } interface A { a: Y; b: X; 1: Z; } interface B extends A { [n: number]: string; c: boolean; 3: boolean; 6(): string; } interface B { 4: boolean; 5: string; } interface C extends A { [s: string]: numb...
{ "end_byte": 581, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propertiesAndIndexers.ts" }
TypeScript/tests/cases/compiler/regularExpressionScanning.ts_0_2552
// @target: es5,es2015,esnext const regexes: RegExp[] = [ // Flags /foo/visualstudiocode, // Pattern modifiers /(?med-ium:bar)/, // Capturing groups /\0/, /\1/, /\2/, /(hi)\1/, /(hi) (hello) \2/, /\2()(\12)(foo)\1\0[\0\1\01\123\08\8](\3\03)\5\005\9\009/, /\2()(\12)(foo)\1\0[\0\1\01\123\08\8](\3\03)\5\005\9...
{ "end_byte": 2552, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/regularExpressionScanning.ts" }
TypeScript/tests/cases/compiler/capturedLetConstInLoop3.ts_0_3450
///=========let declare function use(a: any); function foo0(x) { for (let x of []) { var v = x; (function() { return x + v }); (() => x + v); } use(v); } function foo0_1(x) { for (let x in []) { var v = x; (function() { return x + v }); (() => x + v); ...
{ "end_byte": 3450, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop3.ts" }
TypeScript/tests/cases/compiler/inferentialTypingObjectLiteralMethod2.ts_0_201
interface Int<T, U> { [s: string]: (x: T) => U; } declare function foo<T, U>(x: T, y: Int<T, U>, z: Int<U, T>): T; foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } });
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferentialTypingObjectLiteralMethod2.ts" }
TypeScript/tests/cases/compiler/recursiveBaseCheck.ts_0_325
declare module Module { class C extends D { } export class B extends Module.C { } export class A extends Module.B { } export class AmChart extends Module.A { } export class D extends AmChart { } export class E extends Module.D { } export class F extends Module.E { ...
{ "end_byte": 325, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveBaseCheck.ts" }
TypeScript/tests/cases/compiler/parenthesizedJSDocCastAtReturnStatement.ts_0_351
// @strict: true // @lib: esnext // @noEmit: true // @checkJs: true // @allowJs: true // @filename: index.js /** @type {Map<string, string | Set<string>>} */ const cache = new Map() /** * @param {string} key * @returns {() => string} */ const getStringGetter = (key) => { return () => { return /** @type {str...
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parenthesizedJSDocCastAtReturnStatement.ts" }
TypeScript/tests/cases/compiler/infinitelyExpandingOverloads.ts_0_910
interface KnockoutSubscription2<T> { target: KnockoutObservableBase2<T>; } interface KnockoutObservableBase2<T> { subscribe(callback: (newValue: T) => void, target?: any, topic?: string): KnockoutSubscription2<T>; } interface ValidationPlacement2<TValue> { initialize(validatable: Validatable2<TValue>): void...
{ "end_byte": 910, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/infinitelyExpandingOverloads.ts" }
TypeScript/tests/cases/compiler/nestedInfinitelyExpandedRecursiveTypes.ts_0_137
interface F<T> { t: G<F<() => T>>; } interface G<U> { t: G<G<() => U>>; } var f: F<string>; var g: G<string>; f = g; g = f;
{ "end_byte": 137, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedInfinitelyExpandedRecursiveTypes.ts" }
TypeScript/tests/cases/compiler/augmentedTypesEnum2.ts_0_282
// enum then interface enum e1 { One } // error interface e1 { // error foo(): void; } // interface then enum works // enum then class enum e2 { One }; // error class e2 { // error foo() { return 1; } } //enum then enum - covered //enum then import - covered
{ "end_byte": 282, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/augmentedTypesEnum2.ts" }
TypeScript/tests/cases/compiler/thisInModuleFunction1.ts_0_78
module bar { export function bar() { return this; } } var z = bar.bar();
{ "end_byte": 78, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInModuleFunction1.ts" }
TypeScript/tests/cases/compiler/thisAssignmentInNamespaceDeclaration1.ts_0_147
// @checkJs: true // @outDir: out/ // @filename: a.js module foo { this.bar = 4; } // @filename: b.js namespace blah { this.prop = 42; }
{ "end_byte": 147, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisAssignmentInNamespaceDeclaration1.ts" }
TypeScript/tests/cases/compiler/genericCallWithFixedArguments.ts_0_139
class A { foo() { } } class B { bar() { }} function g<T, U>(x) { } g<A, B>(7) // the parameter list is fixed, so this should not error
{ "end_byte": 139, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericCallWithFixedArguments.ts" }
TypeScript/tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions6.ts_3_156
@target: es6 function f(x: TemplateStringsArray, y: string, z: string) { } // Incomplete call, not enough parameters, at EOF. f `123qdawdrqw${ 1 }${
{ "end_byte": 156, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions6.ts" }
TypeScript/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts_0_88
// @allowUnreachableCode: true var f: (x: 'hi') => number = (x: 'hi') => { return 1; };
{ "end_byte": 88, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts" }
TypeScript/tests/cases/compiler/typeInferenceConflictingCandidates.ts_0_72
declare function g<T>(a: T, b: T, c: (t: T) => T): T; g("", 3, a => a);
{ "end_byte": 72, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeInferenceConflictingCandidates.ts" }
TypeScript/tests/cases/compiler/localClassesInLoop_ES6.ts_0_178
// @target: ES6 declare function use(a: any); "use strict" var data = []; for (let x = 0; x < 2; ++x) { class C { } data.push(() => C); } use(data[0]() === data[1]());
{ "end_byte": 178, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/localClassesInLoop_ES6.ts" }
TypeScript/tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts_0_229
interface InterfaceWithMultipleTypars<A, A> { // should error bar(): void; } interface InterfaceWithSomeTypars<B> { // should not error bar(): void; } interface InterfaceWithSomeTypars<C, C> { // should error bar2(): void; }
{ "end_byte": 229, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts" }
TypeScript/tests/cases/compiler/unusedImports4.ts_0_304
//@noUnusedLocals:true //@noUnusedParameters:true // @Filename: file1.ts export class Calculator { handleChar() {} } export function test() { } export function test2() { } // @Filename: file2.ts import {Calculator, test, test2} from "./file1" var x = new Calculator(); x.handleChar(); test2();
{ "end_byte": 304, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedImports4.ts" }
TypeScript/tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts_0_67
function bar<T>(item1: T, item2: T) { } bar(1, ""); // Should be ok
{ "end_byte": 67, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts" }
TypeScript/tests/cases/compiler/continueTarget6.ts_0_35
while (true) { continue target; }
{ "end_byte": 35, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/continueTarget6.ts" }
TypeScript/tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts_0_151
class A { aProp: string; } module A { export interface X { s: string } export var a = 10; } module B { var A = 1; import Y = A; }
{ "end_byte": 151, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts" }
TypeScript/tests/cases/compiler/collisionArgumentsInterfaceMembers.ts_0_655
// call interface i1 { (i: number, ...arguments); // no error - no code gen } interface i12 { (arguments: number, ...rest); // no error - no code gen } interface i1NoError { (arguments: number); // no error } // new interface i2 { new (i: number, ...arguments); // no error - no code gen } interface i2...
{ "end_byte": 655, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionArgumentsInterfaceMembers.ts" }
TypeScript/tests/cases/compiler/amdDependencyCommentName4.ts_0_437
//@module: amd ///<amd-dependency path='aliasedModule5' name='n1'/> ///<amd-dependency path='unaliasedModule3'/> ///<amd-dependency path='aliasedModule6' name='n2'/> ///<amd-dependency path='unaliasedModule4'/> import "unaliasedModule1"; import r1 = require("aliasedModule1"); r1; import {p1, p2, p3} from "aliasedMod...
{ "end_byte": 437, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/amdDependencyCommentName4.ts" }
TypeScript/tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty8.ts_0_226
// @strict: true // @target: esnext // @filename: ./a.ts export const key = "a"; // @filename: ./b.ts import * as a from "./a"; export class C { [a.key]: string; constructor() { this[a.key] = "foo"; } }
{ "end_byte": 226, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty8.ts" }
TypeScript/tests/cases/compiler/requireOfJsonFileWithSourceMap.ts_0_340
// @module: commonjs // @outdir: out/ // @allowJs: true // @fullEmitPaths: true // @resolveJsonModule: true // @sourceMap: true // @Filename: file1.ts import b1 = require('./b.json'); let x = b1.a; import b2 = require('./b.json'); if (x) { let b = b2.b; x = (b1.b === b); } // @Filename: b.json { "a": true...
{ "end_byte": 340, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireOfJsonFileWithSourceMap.ts" }
TypeScript/tests/cases/compiler/systemModule5.ts_0_45
// @module: system export function foo() {}
{ "end_byte": 45, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/systemModule5.ts" }
TypeScript/tests/cases/compiler/downlevelLetConst13.ts_0_482
// @target:es5 // @module: commonjs 'use strict' // exported let\const bindings should not be renamed export let foo = 10; export const bar = "123" export let [bar1] = [1]; export const [bar2] = [2]; export let {a: bar3} = { a: 1 }; export const {a: bar4} = { a: 1 }; export module M { export let baz = 100; e...
{ "end_byte": 482, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/downlevelLetConst13.ts" }
TypeScript/tests/cases/compiler/nestedBlockScopedBindings15.ts_0_358
for (; false;) { { let x; () => x; } } for (; false;) { { let y; y = 1; } } for (; false;) { switch (1){ case 1: let z0; () => z0; break; } } for (; false;) { switch (1){ case 1: let z; ...
{ "end_byte": 358, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedBlockScopedBindings15.ts" }
TypeScript/tests/cases/compiler/genericPrototypeProperty.ts_0_132
class C<T> { x: T; foo(x: T): T { return null; } } var r = C.prototype; // should be any var r2 = r.x var r3 = r.foo(null);
{ "end_byte": 132, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericPrototypeProperty.ts" }
TypeScript/tests/cases/compiler/reboundIdentifierOnImportAlias.ts_0_94
module Foo { export var x = "hello"; } module Bar { var Foo = 1; import F = Foo; }
{ "end_byte": 94, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reboundIdentifierOnImportAlias.ts" }
TypeScript/tests/cases/compiler/incrementalTsBuildInfoFile.ts_0_96
// @incremental: true // @tsBuildInfoFile: /a.tsbuildinfo // @Filename: /a.ts const x = 10;
{ "end_byte": 96, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/incrementalTsBuildInfoFile.ts" }
TypeScript/tests/cases/compiler/assignmentCompatability26.ts_0_336
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 aa:{one:string;};; export var __val__aa = aa; } __test2__.__val__aa = __tes...
{ "end_byte": 336, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability26.ts" }
TypeScript/tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts_0_576
// @declaration: true var { } = { x: 5, y: "hello" }; var { x4 } = { x4: 5, y4: "hello" }; var { y5 } = { x5: 5, y5: "hello" }; var { x6, y6 } = { x6: 5, y6: "hello" }; var { x7: a1 } = { x7: 5, y7: "hello" }; var { y8: b1 } = { x8: 5, y8: "hello" }; var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; var { a: x11, b: {...
{ "end_byte": 576, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts" }
TypeScript/tests/cases/compiler/unknownPropertiesAreAssignableToObjectUnion.ts_0_104
// @strictNullChecks: true const x: Object | string = { x: 0 }; const y: Object | undefined = { x: 0 };
{ "end_byte": 104, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unknownPropertiesAreAssignableToObjectUnion.ts" }
TypeScript/tests/cases/compiler/withStatementErrors.ts_0_302
declare var ooo:any; with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) { // error bing = true; // no error bang = true; // no error function bar() {} // no error bar(); // no error class C {} // error interface I {} // error module M {} // error }
{ "end_byte": 302, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/withStatementErrors.ts" }
TypeScript/tests/cases/compiler/isolatedDeclarationErrors.ts_0_301
// @declaration: true // @isolatedDeclarations: true // @target: ESNext function errorOnAssignmentBelowDecl(): void {} errorOnAssignmentBelowDecl.a = ""; const errorOnAssignmentBelow = (): void => {} errorOnAssignmentBelow.a = ""; const errorOnMissingReturn = () => {} errorOnMissingReturn.a = "";
{ "end_byte": 301, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedDeclarationErrors.ts" }
TypeScript/tests/cases/compiler/simpleArrowFunctionParameterReferencedInObjectLiteral1.ts_0_39
[].map(() => [].map(p => ({ X: p })));
{ "end_byte": 39, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/simpleArrowFunctionParameterReferencedInObjectLiteral1.ts" }
TypeScript/tests/cases/compiler/noIterationTypeErrorsInCFA.ts_0_227
// @strict: true // @target: esnext interface F { d(): void } export function doRemove(dds: F | F[]) { if (!Array.isArray(dds)) { dds = [dds] } for (let n of dds) { n.d() } return dds }
{ "end_byte": 227, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noIterationTypeErrorsInCFA.ts" }
TypeScript/tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx_0_202
//@jsx: react declare var React: any; <View> <ListView refreshControl={ <RefreshControl onRefresh={} refreshing={} /> } dataSource={this.state.ds} renderRow={}> </ListView> </View>
{ "end_byte": 202, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx" }
TypeScript/tests/cases/compiler/testContainerList.ts_0_99
// Regression test for #325 module A { class C { constructor(public d: {}) { } } }
{ "end_byte": 99, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/testContainerList.ts" }
TypeScript/tests/cases/compiler/overloadOnConstInheritance3.ts_0_227
interface Base { addEventListener(x: string): any; } interface Deriver extends Base { // shouldn't need to redeclare the string overload addEventListener(x: 'bar'): string; addEventListener(x: 'foo'): string; }
{ "end_byte": 227, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadOnConstInheritance3.ts" }
TypeScript/tests/cases/compiler/unusedSemicolonInClass.ts_0_48
// @noUnusedLocals: true class Unused { ; }
{ "end_byte": 48, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedSemicolonInClass.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationGlobal7.ts_0_75
namespace A { declare global { interface Array<T> { x } } }
{ "end_byte": 75, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationGlobal7.ts" }