_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts_0_193 | // @target: es5
// @module: commonjs
// @declaration: true
var before: typeof func = func();
export default function func(): typeof func {
return func;
}
var after: typeof func = func(); | {
"end_byte": 193,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts"
} |
TypeScript/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts_3_168 | ass A {
blub = 6;
}
class B extends A {
blub = 12;
constructor() {
"use strict";
'someStringForEgngInject';
super()
}
} | {
"end_byte": 168,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts"
} |
TypeScript/tests/cases/compiler/acceptableAlias1.ts_0_82 | module M {
export module N {
}
export import X = N;
}
import r = M.X; | {
"end_byte": 82,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/acceptableAlias1.ts"
} |
TypeScript/tests/cases/compiler/importDeclWithClassModifiers.ts_0_153 | //@module: amd
module x {
interface c {
}
}
export public import a = x.c;
export private import b = x.c;
export static import c = x.c;
var b: a;
| {
"end_byte": 153,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importDeclWithClassModifiers.ts"
} |
TypeScript/tests/cases/compiler/sourceMapValidationIfElse.ts_0_176 | // @sourcemap: true
var i = 10;
if (i == 10) {
i++;
} else
{
}
if (i == 10)
{
i++;
}
else if (i == 20) {
i--;
} else if (i == 30) {
i += 70;
} else {
i--;
} | {
"end_byte": 176,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationIfElse.ts"
} |
TypeScript/tests/cases/compiler/abstractInterfaceIdentifierName.ts_1_46 | interface abstract {
abstract(): void;
}
| {
"end_byte": 46,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/abstractInterfaceIdentifierName.ts"
} |
TypeScript/tests/cases/compiler/castOfYield.ts_0_146 | function* f() {
<number> (yield 0);
// Unlike await, yield is not allowed to appear in a simple unary expression.
<number> yield 0;
}
| {
"end_byte": 146,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/castOfYield.ts"
} |
TypeScript/tests/cases/compiler/exportSameNameFuncVar.ts_0_57 | //@module: amd
export var a = 10;
export function a() {
} | {
"end_byte": 57,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportSameNameFuncVar.ts"
} |
TypeScript/tests/cases/compiler/deleteOperatorInStrictMode.ts_0_29 | "use strict"
var a;
delete a; | {
"end_byte": 29,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deleteOperatorInStrictMode.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitMixinPrivateProtected.ts_0_708 | // @declaration: true
// @filename: first.ts
declare function mix<TMix>(mixin: TMix): TMix;
const DisposableMixin = class {
protected _onDispose() {
this._assertIsStripped()
}
private _assertIsStripped() {
}
};
// No error, but definition is wrong.
export default mix(DisposableMixin);
export ... | {
"end_byte": 708,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitMixinPrivateProtected.ts"
} |
TypeScript/tests/cases/compiler/collisionArgumentsFunction.ts_0_1680 | // Functions
function f1(arguments: number, ...restParameters) { //arguments is error
var arguments = 10; // no error
}
function f12(i: number, ...arguments) { //arguments is error
var arguments: any[]; // no error
}
function f1NoError(arguments: number) { // no error
var arguments = 10; // no error
}
decl... | {
"end_byte": 1680,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionArgumentsFunction.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitAnyComputedPropertyInClass.ts_0_190 | // @declaration: true
// @declaration
// @filename: ambient.d.ts
declare module "abcdefgh";
// @filename: main.ts
import Test from "abcdefgh";
export class C {
[Test.someKey]() {};
}
| {
"end_byte": 190,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitAnyComputedPropertyInClass.ts"
} |
TypeScript/tests/cases/compiler/giant.ts_0_6942 | //@module: amd
// @declaration: true
/*
Prefixes
p -> public
r -> private
i -> import
e -> export
a -> ambient
t -> static
s -> set
g -> get
MAX DEPTH 3 LEVELS
*/
const p = "propName";
var V;
function F() { };
class C {
constructor () { }
public pV;
private rV;
... | {
"end_byte": 6942,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/giant.ts"
} |
TypeScript/tests/cases/compiler/giant.ts_6947_13719 | //(p10:string, p8?: string, ...p9: any[]);
//Construct Signature
new ();
new (): number;
new (p: string);
new (p2?: string);
new (...p3: any[]);
new (p4: string, p5?: string);
new (p6: string, ...p7: any[]);
//Index Signature
[p];
[p1: string];
[p2: string, p3: numb... | {
"end_byte": 13719,
"start_byte": 6947,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/giant.ts"
} |
TypeScript/tests/cases/compiler/giant.ts_13728_15652 | p3();
p4? ();
p5? (): void;
p6(pa1): void;
p7(pa1, pa2): void;
p7? (pa1, pa2): void;
}
module M {
var V;
function F() { };
class C { }
interface I { }
module M { }
export var eV;
export function eF() { };
exp... | {
"end_byte": 15652,
"start_byte": 13728,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/giant.ts"
} |
TypeScript/tests/cases/compiler/deeplyDependentLargeArrayMutation2.ts_0_663 | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @filename: foo.js
// Looking at this test and thinking "that's silly, nobody would write code like that" and thinking it's OK to break this test?
// You'd be wrong - https://raw.githubusercontent.com/archilogic-com/3dio-js/master/build/3dio.js and plenty of other ... | {
"end_byte": 663,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deeplyDependentLargeArrayMutation2.ts"
} |
TypeScript/tests/cases/compiler/deeplyDependentLargeArrayMutation2.ts_664_5074 | {
let i = 0;
const arr = [];
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] ... | {
"end_byte": 5074,
"start_byte": 664,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deeplyDependentLargeArrayMutation2.ts"
} |
TypeScript/tests/cases/compiler/deeplyDependentLargeArrayMutation2.ts_5079_8946 | arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
arr[i++] = arr[i] + 1;
... | {
"end_byte": 8946,
"start_byte": 5079,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deeplyDependentLargeArrayMutation2.ts"
} |
TypeScript/tests/cases/compiler/es5-asyncFunctionConditionals.ts_0_279 | // @lib: es5,es2015.promise
// @noEmitHelpers: true
// @target: ES5
declare var x, y, z, a, b, c;
async function conditional0() {
a = (await x) ? y : z;
}
async function conditional1() {
a = x ? await y : z;
}
async function conditional2() {
a = x ? y : await z;
} | {
"end_byte": 279,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-asyncFunctionConditionals.ts"
} |
TypeScript/tests/cases/compiler/isolatedModulesSourceMap.ts_0_102 | // @isolatedModules: true
// @sourceMap:true
// @target: es6
// @filename: file1.ts
export var x = 1; | {
"end_byte": 102,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesSourceMap.ts"
} |
TypeScript/tests/cases/compiler/spreadExpressionContainingObjectExpressionContextualType.ts_0_214 | // @noEmit: true
// repro #49585
const { value } = (() => ({
value: "",
...(true ? {} : {}),
}))();
// repro 49684#discussion_r920545763
const { value2 } = {
value2: "",
...(() => true ? {} : {})(),
};
| {
"end_byte": 214,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spreadExpressionContainingObjectExpressionContextualType.ts"
} |
TypeScript/tests/cases/compiler/typeParametersInStaticAccessors.ts_0_100 | class foo<T> {
static get Foo(): () => T { return null; }
static set Bar(v: { v: T }) { }
} | {
"end_byte": 100,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParametersInStaticAccessors.ts"
} |
TypeScript/tests/cases/compiler/genericCallSpecializedToTypeArg.ts_0_229 | function dupe<T>(x: T): T {
return x;
}
function dupeAndGetDist<U>(x: U): U {
var y = dupe(x); //<-- dupe has incorrect type here
y.getDist(); //<-- this requires a missing constraint, but it's not caught
return y;
}
| {
"end_byte": 229,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericCallSpecializedToTypeArg.ts"
} |
TypeScript/tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts_0_590 | declare function _<T>(value: Array<T>): _<T>;
declare function _<T>(value: T): _<T>;
declare module _ {
export function each<T>(
//list: List<T>,
//iterator: ListIterator<T, void>,
context?: any): void;
interface ListIterator<T, TResult> {
(value: T, index: number, list: T[]): ... | {
"end_byte": 590,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts"
} |
TypeScript/tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts_0_76 | let x: { foo, bar }
let y: { foo: number, bar }
let z: { foo, bar: number }
| {
"end_byte": 76,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts"
} |
TypeScript/tests/cases/compiler/stringLiteralsErrors.ts_0_428 | // Srtings missing line terminator
var es1 = "line 1
";
var es2 = 'line 1
';
// Space after backslash
var es3 = 'line 1\
';
var es4 = 'line 1\
';
// Unterminated strings
var es5 = "unterminated
var es6 = 'unterminated
// wrong terminator
var es7 = "unterminated '
var es8 = 'unterminated "
// wrong unicode sequenc... | {
"end_byte": 428,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/stringLiteralsErrors.ts"
} |
TypeScript/tests/cases/compiler/umdNamespaceMergedWithGlobalAugmentationIsNotCircular.ts_0_435 | // @strict: true
// @module: esnext
// @moduleResolution: node
// @target: es2018
// @filename: global.d.ts
declare global {
const React: typeof import("./module");
}
export { };
// @filename: module.d.ts
export = React;
export as namespace React;
declare namespace React {
function createRef(): any;
}
// @f... | {
"end_byte": 435,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/umdNamespaceMergedWithGlobalAugmentationIsNotCircular.ts"
} |
TypeScript/tests/cases/compiler/namedFunctionExpressionCallErrors.ts_0_248 | var recurser = function foo() {
};
// Error: foo should not be visible here
foo();
// recurser should be
recurser();
(function bar() {
// Error: foo should not be visible here either
foo();
});
// Error: bar should not be visible
bar(); | {
"end_byte": 248,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/namedFunctionExpressionCallErrors.ts"
} |
TypeScript/tests/cases/compiler/thisInModule.ts_0_43 | module myMod {
var x;
this.x = 5;
} | {
"end_byte": 43,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInModule.ts"
} |
TypeScript/tests/cases/compiler/alwaysStrictModule.ts_0_117 | // @module: commonjs
// @alwaysStrict: true
module M {
export function f() {
var arguments = [];
}
} | {
"end_byte": 117,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/alwaysStrictModule.ts"
} |
TypeScript/tests/cases/compiler/typeInferenceFBoundedTypeParams.ts_0_436 | // Example from #6037
function fold<a, r>(values: a[], result: r, fold: (result: r, value: a) => r): r {
for (let value of values) {
result = fold(result, value);
}
return result;
}
function append<a, b extends a>(values: a[], value: b): a[] {
values.push(value);
return values;
}
fold(
... | {
"end_byte": 436,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeInferenceFBoundedTypeParams.ts"
} |
TypeScript/tests/cases/compiler/isArray.ts_0_141 | var maybeArray: number | number[];
if (Array.isArray(maybeArray)) {
maybeArray.length; // OK
}
else {
maybeArray.toFixed(); // OK
} | {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isArray.ts"
} |
TypeScript/tests/cases/compiler/argumentsObjectIterator01_ES5.ts_0_238 | //@target: ES5
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let result = [];
for (let arg of arguments) {
result.push(arg + arg);
}
return <[any, any, any]>result;
} | {
"end_byte": 238,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/argumentsObjectIterator01_ES5.ts"
} |
TypeScript/tests/cases/compiler/declFileForInterfaceWithOptionalFunction.ts_0_85 | // @declaration: true
interface I {
foo? (x?);
foo2? (x?: number): number;
} | {
"end_byte": 85,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileForInterfaceWithOptionalFunction.ts"
} |
TypeScript/tests/cases/compiler/typeValueConflict2.ts_0_304 | module M1 {
export class A<T> {
constructor(a: T) {
}
}
}
module M2 {
var M1 = 0;
// Should error. M1 should bind to the variable, not to the module.
class B extends M1.A<string> {
}
}
module M3 {
// Shouldn't error
class B extends M1.A<string> {
}
}
| {
"end_byte": 304,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeValueConflict2.ts"
} |
TypeScript/tests/cases/compiler/typeCheckTypeArgument.ts_1_236 | var f: <T extends UNKNOWN>() => void;
interface IFoo<T extends UNKNOWN> { }
class Foo<T extends UNKNOWN> { }
function bar<T extends UNKNOWN>() { }
class Foo2 {
method<T extends UNKNOWN>() { }
}
(<T extends UNKNOWN>(a) => { }); | {
"end_byte": 236,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeCheckTypeArgument.ts"
} |
TypeScript/tests/cases/compiler/unionTypeWithIndexedLiteralType.ts_0_117 | interface I { x: number; }
interface Idx { [index: string]: U; }
type U = Idx | I | "lit";
const u: U = { x: "lit" }; | {
"end_byte": 117,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unionTypeWithIndexedLiteralType.ts"
} |
TypeScript/tests/cases/compiler/moduleProperty1.ts_0_344 | module M {
var x=10; // variable local to this module body
var y=x; // property visible only in module
export var z=y; // property visible to any code
}
module M2 {
var x = 10; // variable local to this module body
private y = x; // can't use private in modules
export var z = y; // proper... | {
"end_byte": 344,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleProperty1.ts"
} |
TypeScript/tests/cases/compiler/bigintWithLib.ts_0_2475 | // @target: es2020
// @declaration: true
// Test BigInt functions
let bigintVal: bigint = BigInt(123);
bigintVal = BigInt("456");
new BigInt(123); // should error
bigintVal = BigInt.asIntN(8, 0xFFFFn);
bigintVal = BigInt.asUintN(8, 0xFFFFn);
bigintVal = bigintVal.valueOf();
let stringVal: string = bigintVal.toString()... | {
"end_byte": 2475,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/bigintWithLib.ts"
} |
TypeScript/tests/cases/compiler/declFileWithExtendsClauseThatHasItsContainerNameConflict.ts_0_240 | // @declaration: true
declare module A.B.C {
class B {
}
}
module A.B {
export class EventManager {
id: number;
}
}
module A.B.C {
export class ContextMenu extends EventManager {
name: string;
}
} | {
"end_byte": 240,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileWithExtendsClauseThatHasItsContainerNameConflict.ts"
} |
TypeScript/tests/cases/compiler/accessorAccidentalCallDiagnostic.ts_0_196 | // @target: es5
// https://github.com/microsoft/TypeScript/issues/24554
class Test24554 {
get property(): number { return 1; }
}
function test24554(x: Test24554) {
return x.property();
}
| {
"end_byte": 196,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/accessorAccidentalCallDiagnostic.ts"
} |
TypeScript/tests/cases/compiler/deeplyNestedConstraints.ts_0_424 | // @strict: true
// @declaration: true
// Repro from #41931
type Enum = Record<string, string | number>;
type TypeMap<E extends Enum> = { [key in E[keyof E]]: number | boolean | string | number[] };
class BufferPool<E extends Enum, M extends TypeMap<E>> {
setArray2<K extends E[keyof E]>(_: K, array: Extract<M[K... | {
"end_byte": 424,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deeplyNestedConstraints.ts"
} |
TypeScript/tests/cases/compiler/typeParametersInStaticProperties.ts_0_34 | class foo<T> {
static P: T;
} | {
"end_byte": 34,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParametersInStaticProperties.ts"
} |
TypeScript/tests/cases/compiler/generatorES6_5.ts_0_56 | // @target: es6
function* foo() {
yield a ? b : c;
} | {
"end_byte": 56,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/generatorES6_5.ts"
} |
TypeScript/tests/cases/compiler/es5ModuleWithModuleGenAmd.ts_0_128 | // @target: ES5
// @module: amd
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
} | {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5ModuleWithModuleGenAmd.ts"
} |
TypeScript/tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts_0_2394 | // @strict: true
// Repro from #30505
export type Prop<T> = { (): T }
export type PropType<T> = Prop<T>;
export type PropDefaultValue<T> = T;
export type PropValidatorFunction<T> = (value: T) => boolean;
export type PropValidator<T> = PropOptions<T>;
export type PropOptions<T> = {
type: PropType<T>;
valu... | {
"end_byte": 2394,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts"
} |
TypeScript/tests/cases/compiler/collisionRestParameterFunction.ts_0_963 | // Functions
function f1(_i: number, ...restParameters) { //_i is error
var _i = 10; // no error
}
function f1NoError(_i: number) { // no error
var _i = 10; // no error
}
declare function f2(_i: number, ...restParameters); // no error - no code gen
declare function f2NoError(_i: number); // no error
function ... | {
"end_byte": 963,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionRestParameterFunction.ts"
} |
TypeScript/tests/cases/compiler/undefinedTypeAssignment1.ts_0_78 | type undefined = string;
function p(undefined = "wat") {
return undefined;
}
| {
"end_byte": 78,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/undefinedTypeAssignment1.ts"
} |
TypeScript/tests/cases/compiler/deprecatedCompilerOptions5.ts_0_451 | // @typeScriptVersion: 6.0
// @filename: /foo/tsconfig.json
{
"compilerOptions": {
"target": "ES3",
"noImplicitUseStrict": true,
"keyofStringsOnly": true,
"suppressExcessPropertyErrors": true,
"suppressImplicitAnyIndexErrors": true,
"noStrictGenericChecks": true,
... | {
"end_byte": 451,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deprecatedCompilerOptions5.ts"
} |
TypeScript/tests/cases/compiler/conditionalExpressionNewLine8.ts_0_39 | var v = a
? b ? d : e
: c ? f : g; | {
"end_byte": 39,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionalExpressionNewLine8.ts"
} |
TypeScript/tests/cases/compiler/importHelpersWithImportOrExportDefaultNoTslib.1.ts_0_261 | // @importHelpers: true
// @target: es2017
// @module: commonjs,system,amd,es2015,es2020
// @esModuleInterop: true,false
// @noEmit: true
// @noTypesAndSymbols: true
// @filename: a.ts
export default class { }
// @filename: b.ts
export { default } from "./a";
| {
"end_byte": 261,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersWithImportOrExportDefaultNoTslib.1.ts"
} |
TypeScript/tests/cases/compiler/restParameterNoTypeAnnotation.ts_0_79 | function foo(...rest) {
var x: number = rest[0];
return x;
}
| {
"end_byte": 79,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/restParameterNoTypeAnnotation.ts"
} |
TypeScript/tests/cases/compiler/deepKeysIndexing.ts_0_1369 | // regression test from https://github.com/Microsoft/TypeScript/issues/29692
interface DeepObject {
[k1: string]: {
[k2: string]: any;
};
}
type keys2broken<
O extends DeepObject,
K1 extends keyof O
> = O[K1] extends object ? Extract<keyof O[K1], string> : never;
type keys2working<
O extends DeepObject,... | {
"end_byte": 1369,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deepKeysIndexing.ts"
} |
TypeScript/tests/cases/compiler/promiseType.ts_0_6525 | // @target: es6
declare var p: Promise<boolean>;
declare var x: any;
async function A() {
const a = await p;
return a;
}
async function B() {
const a = await p;
return 1;
}
async function C() {
try {
const a = await p;
return 1;
}
catch (e) {
return 'error';
}
... | {
"end_byte": 6525,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/promiseType.ts"
} |
TypeScript/tests/cases/compiler/promiseType.ts_6526_7117 | const pc6 = p.then(() => Promise.reject("1"), () => {});
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
Promise.resolve(undefined as Promise<string> | number... | {
"end_byte": 7117,
"start_byte": 6526,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/promiseType.ts"
} |
TypeScript/tests/cases/compiler/typeAssertionToGenericFunctionType.ts_0_233 | var x = {
a: < <T>(x: T) => T > ((x: any) => 1),
b: <T>(x: T) => { x }
}
x.a<string>(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition
x.b<string>(); // error | {
"end_byte": 233,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeAssertionToGenericFunctionType.ts"
} |
TypeScript/tests/cases/compiler/thisInSuperCall1.ts_0_134 | class Base {
constructor(a: any) {}
}
class Foo extends Base {
constructor(public x: number) {
super(this);
}
}
| {
"end_byte": 134,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInSuperCall1.ts"
} |
TypeScript/tests/cases/compiler/interfaceNameAsIdentifier.ts_0_108 | interface C {
(): void;
}
C();
module m2 {
export interface C {
(): void;
}
}
m2.C();
| {
"end_byte": 108,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/interfaceNameAsIdentifier.ts"
} |
TypeScript/tests/cases/compiler/assignmentCompatability3.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 obj = {one: 1};
export var __val__obj = obj;
}
__test2__.__val__obj = __tes... | {
"end_byte": 336,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability3.ts"
} |
TypeScript/tests/cases/compiler/validRegexp.ts_0_68 | var x = / [a - z /]$ / i;
var x1 = /[a-z/]$/i;
var x2 = /[a-z/]$ /i; | {
"end_byte": 68,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/validRegexp.ts"
} |
TypeScript/tests/cases/compiler/declFileForTypeParameters.ts_0_95 | // @declaration: true
class C<T> {
x: T;
foo(a: T): T {
return this.x;
}
} | {
"end_byte": 95,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileForTypeParameters.ts"
} |
TypeScript/tests/cases/compiler/typeUsedAsValueError.ts_0_418 | interface Interface {
}
class SomeClass {
}
type TypeAliasForSomeClass = SomeClass;
type someType = { x: number };
function acceptsSomeType(a: someType) {
}
let one = Interface;
let two = InterfaceNotFound;
let three = TypeAliasForSomeClass;
let four = new TypeAliasForSomeClass();
let five = new TypeAliasForSome... | {
"end_byte": 418,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeUsedAsValueError.ts"
} |
TypeScript/tests/cases/compiler/esModuleInteropImportNamespace.ts_0_185 | // @esModuleInterop: true
// @Filename: foo.d.ts
declare function foo(): void;
declare namespace foo {}
export = foo;
// @Filename: index.ts
import * as foo from "./foo";
foo.default;
| {
"end_byte": 185,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/esModuleInteropImportNamespace.ts"
} |
TypeScript/tests/cases/compiler/functionOverloadAmbiguity1.ts_0_340 | function callb(lam: (l: number) => void );
function callb(lam: (n: string) => void );
function callb(a) { }
callb((a) => { a.length; } ); // error, chose first overload
function callb2(lam: (n: string) => void );
function callb2(lam: (l: number) => void );
function callb2(a) { }
callb2((a) => { a.length; } ); // ok, c... | {
"end_byte": 340,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloadAmbiguity1.ts"
} |
TypeScript/tests/cases/compiler/moduleResolutionNoTsESM.ts_0_404 | // ESM output
// @module: es2015
// @jsx: Preserve
// @filename: x.ts
export default 0;
// @filename: y.tsx
export default 0;
// @filename: z.d.ts
declare const x: number;
export default x;
// @filename: user.ts
import x from "./x.ts";
import y from "./y.tsx";
import z from "./z.d.ts";
// Making sure the suggested... | {
"end_byte": 404,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionNoTsESM.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitTopLevelNodeFromCrossFile.ts_0_295 | // @declaration: true
// @filename: a.ts
export type X = string;
export const fn = { o: (a?: (X | undefined)[]) => {} };
// @filename: b.ts
import {fn} from "./a";
export const m = {
/**
* leading doc for prop
*/
prop: 1
}
export const x = { p: fn }; | {
"end_byte": 295,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitTopLevelNodeFromCrossFile.ts"
} |
TypeScript/tests/cases/compiler/divergentAccessorsTypes6.ts_0_934 | // @lib: esnext,dom
// @declaration: true
export {};
interface Element {
get style(): CSSStyleDeclaration;
set style(cssText: string);
}
declare const element: Element;
element.style = "color: red";
element.style.animationTimingFunction;
element.style = element.style; // error
// Now that we don't check for... | {
"end_byte": 934,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/divergentAccessorsTypes6.ts"
} |
TypeScript/tests/cases/compiler/typeReferenceDirectives10.ts_0_350 | // @noImplicitReferences: true
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /
// @filename: /ref.d.ts
export interface $ { x }
// @filename: /types/lib/index.d.ts
declare let $: { x: number }
// @filename: /app.ts
/// <reference types="lib"/>
import {$} from "./ref";
ex... | {
"end_byte": 350,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeReferenceDirectives10.ts"
} |
TypeScript/tests/cases/compiler/arrayLiteralInNonVarArgParameter.ts_0_78 | function panic(val: string[], ...opt: string[]) { }
panic([], 'one', 'two');
| {
"end_byte": 78,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/arrayLiteralInNonVarArgParameter.ts"
} |
TypeScript/tests/cases/compiler/invalidSymbolInTypeParameter1.ts_0_82 | function test() {
var cats = new Array<WAWA>(); // WAWA is not a valid type
}
| {
"end_byte": 82,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/invalidSymbolInTypeParameter1.ts"
} |
TypeScript/tests/cases/compiler/primitiveTypeAsmoduleName.ts_0_16 | module string {} | {
"end_byte": 16,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/primitiveTypeAsmoduleName.ts"
} |
TypeScript/tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts_0_67 | class Bar {
public clone() {
return new Bar(0);
}
} | {
"end_byte": 67,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts"
} |
TypeScript/tests/cases/compiler/genericTypeWithCallableMembers2.ts_0_228 | function foo1<T extends { (): string; }>(f: T) {
return f(); // should return 'string', once returned 'any'
}
function foo2<T extends { new (): string; }>(f: T) {
return new f(); // should be legal, once was an error
} | {
"end_byte": 228,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericTypeWithCallableMembers2.ts"
} |
TypeScript/tests/cases/compiler/continueInIterationStatement3.ts_0_24 | for (;;) {
continue;
} | {
"end_byte": 24,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/continueInIterationStatement3.ts"
} |
TypeScript/tests/cases/compiler/moduleRedifinitionErrors.ts_0_25 | class A {
}
module A {
}
| {
"end_byte": 25,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleRedifinitionErrors.ts"
} |
TypeScript/tests/cases/compiler/genericOfACloduleType1.ts_0_281 | class G<T>{ bar(x: T) { return x; } }
module M {
export class C { foo() { } }
export module C {
export class X {
}
}
var g1 = new G<C>();
g1.bar(null).foo();
}
var g2 = new G<M.C>() // was: error Type reference cannot refer to container 'M.C'. | {
"end_byte": 281,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericOfACloduleType1.ts"
} |
TypeScript/tests/cases/compiler/typePredicatesInUnion3.ts_0_1247 | // @strict: true
// @noEmit: true
// A union of function types is considered a type predicate if at least one constituent is a type
// predicate and the other constituents are matching type predicates or functions returning `false`.
type P1 = (x: unknown) => x is string;
type P2 = (x: unknown) => x is number;
type F... | {
"end_byte": 1247,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typePredicatesInUnion3.ts"
} |
TypeScript/tests/cases/compiler/specializeVarArgs1.ts_0_250 | interface Observable<T>{ }
interface ObservableArray<T> extends Observable<T[]>
{
push(...values: T[]);
}
function observableArray<T>(): ObservableArray<T> { return null;}
var a = observableArray<string>();
a.push('Some Value');
| {
"end_byte": 250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/specializeVarArgs1.ts"
} |
TypeScript/tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors3.ts_0_14 | (...) => 105;
| {
"end_byte": 14,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors3.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationSyntaxError.ts_0_91 | // @allowJs: true
// @filename: a.js
/**
* @type {number}
* @type {string}
*/
var v;
| {
"end_byte": 91,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationSyntaxError.ts"
} |
TypeScript/tests/cases/compiler/truthinessCallExpressionCoercion2.ts_0_3356 | // @strictNullChecks: true
// @lib: esnext,dom
declare class A {
static from(): string;
}
declare class B {
static from(): string;
}
function test(required1: () => boolean, required2: () => boolean, b: boolean, optional?: () => boolean) {
// error
required1 && console.log('required');
// error
... | {
"end_byte": 3356,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/truthinessCallExpressionCoercion2.ts"
} |
TypeScript/tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts_3_156 | ass Base {
constructor(...arg) {
}
}
class Super extends Base {
constructor() {
(() => this); // No Error
super();
}
} | {
"end_byte": 156,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts"
} |
TypeScript/tests/cases/compiler/defaultKeywordWithoutExport1.ts_0_113 | // @experimentaldecorators: true
declare function decorator(constructor: any): any;
@decorator
default class {} | {
"end_byte": 113,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/defaultKeywordWithoutExport1.ts"
} |
TypeScript/tests/cases/compiler/constEnumMergingWithValues2.ts_0_99 | //@module: amd
//@filename: m1.ts
class foo {}
module foo {
const enum E { X }
}
export = foo | {
"end_byte": 99,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constEnumMergingWithValues2.ts"
} |
TypeScript/tests/cases/compiler/mappedTypeRecursiveInference2.ts_0_608 | // @strict: true
// @noEmit: true
type MorphTuple = [string, "|>", any]
type validateMorph<def extends MorphTuple> = def[1] extends "|>"
? [validateDefinition<def[0]>, "|>", (In: def[0]) => unknown]
: def
type validateDefinition<def> = def extends MorphTuple
? validateMorph<def>
: {
[k in k... | {
"end_byte": 608,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mappedTypeRecursiveInference2.ts"
} |
TypeScript/tests/cases/compiler/flatArrayNoExcessiveStackDepth.ts_0_549 | // @strict: true
// @declaration: true
// @target: esnext
// Repro from #43493
declare const foo: unknown[];
const bar = foo.flatMap(bar => bar as Foo);
interface Foo extends Array<string> {}
// Repros from comments in #43249
const repro_43249 = (value: unknown) => {
if (typeof value !== "string") {
th... | {
"end_byte": 549,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/flatArrayNoExcessiveStackDepth.ts"
} |
TypeScript/tests/cases/compiler/functionOverloads14.ts_0_95 | function foo():{a:number;}
function foo():{a:string;}
function foo():{a:any;} { return {a:1} }
| {
"end_byte": 95,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads14.ts"
} |
TypeScript/tests/cases/compiler/forwardRefInClassProperties.ts_0_267 | class Test
{
_b = this._a; // undefined, no error/warning
_a = 3;
static _B = Test._A; // undefined, no error/warning
static _A = 3;
method()
{
let a = b; // Property 'b' is used before its initialization.
let b = 3;
}
}
| {
"end_byte": 267,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/forwardRefInClassProperties.ts"
} |
TypeScript/tests/cases/compiler/sourceMapValidationSwitch.ts_0_368 | // @sourcemap: true
var x = 10;
switch (x) {
case 5:
x++;
break;
case 10:
{
x--;
break;
}
default:
x = x *10;
}
switch (x)
{
case 5:
x++;
break;
case 10:
{
x--;
break;
}
defaul... | {
"end_byte": 368,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationSwitch.ts"
} |
TypeScript/tests/cases/compiler/arrowFunctionMissingCurlyWithSemicolon.ts_0_103 | // Should error at semicolon.
var f = () => ;
var b = 1 * 2 * 3 * 4;
var square = (x: number) => x * x; | {
"end_byte": 103,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/arrowFunctionMissingCurlyWithSemicolon.ts"
} |
TypeScript/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts_0_597 | // @lib: es5
// @sourcemap: true
declare var console: {
log(msg: string): void;
}
type Robot = [number, string, string];
var robotA: Robot = [1, "mower", "mowing"];
var robotB: Robot = [2, "trimmer", "trimming"];
let [, nameA = "noName"] = robotA;
let [numberB = -1] = robotB;
let [numberA2 = -1, nameA2 = "noName",... | {
"end_byte": 597,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts"
} |
TypeScript/tests/cases/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.ts_0_674 | // @target: es5
// @noemit: true
// Shadowed captured this and super
class Base { }
class C extends Base {
constructor() {
super();
}
foo() {
let _this = this;
() => {
_this;
};
}
bar() {
let _super = this;
}
}
/// shadowed arguments
func... | {
"end_byte": 674,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.ts"
} |
TypeScript/tests/cases/compiler/es6MemberScoping.ts_2_246 | class Foo {
constructor(store: string) { }
public foo() {
return this._store.length;
}
public _store = store; // should be an error.
}
class Foo2 {
static Foo2():number { return 0; } // should not be an error
}
| {
"end_byte": 246,
"start_byte": 2,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6MemberScoping.ts"
} |
TypeScript/tests/cases/compiler/destructuringTempOccursAfterPrologue.ts_0_86 | function test(p: any) {
'use strict';
'use strong';
p = { prop: p } = p;
} | {
"end_byte": 86,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructuringTempOccursAfterPrologue.ts"
} |
TypeScript/tests/cases/compiler/newOperator.ts_3_1017 | terface ifc { }
// Attempting to 'new' an interface yields poor error
var i = new ifc();
// Parens are optional
var x = new Date;
var y = new Date();
// Target is not a class or var, good error
var t1 = new 53();
var t2 = new ''();
new string;
// Use in LHS of expression?
(new Date()).toString();
// Various spacing... | {
"end_byte": 1017,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/newOperator.ts"
} |
TypeScript/tests/cases/compiler/undeclaredMethod.ts_1_132 | module M {
export class C {
public salt() {}
}
}
var c:M.C = new M.C();
c.salt(); // cool
c.saltbar(); // crash
| {
"end_byte": 132,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/undeclaredMethod.ts"
} |
TypeScript/tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts_0_4025 | // @target: ES5
// @module: commonjs
// @declaration: true
// @Filename: privacyCannotNameAccessorDeclFile_GlobalWidgets.ts
declare module "GlobalWidgets" {
export class Widget3 {
name: string;
}
export function createWidget3(): Widget3;
export module SpecializedGlobalWidget {
export c... | {
"end_byte": 4025,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationImportEqualsSyntax.ts_0_50 | // @allowJs: true
// @filename: a.js
import a = b; | {
"end_byte": 50,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationImportEqualsSyntax.ts"
} |
TypeScript/tests/cases/compiler/lambdaExpression.ts_0_116 | () => 0; // Needs to be wrapped in parens to be a valid expression (not declaration)
var y = 0;
(()=>0);
var x = 0;
| {
"end_byte": 116,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/lambdaExpression.ts"
} |
TypeScript/tests/cases/compiler/noCollisionThisExpressionAndLocalVarInFunction.ts_0_118 | // @lib: es5
var console: {
log(val: any);
}
function x() {
var _this = 5;
x => { console.log(_this); };
} | {
"end_byte": 118,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noCollisionThisExpressionAndLocalVarInFunction.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.