_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/compiler/errorMessagesIntersectionTypes01.ts_0_228 | interface Foo {
fooProp: boolean;
}
interface Bar {
barProp: string;
}
interface FooBar extends Foo, Bar {
}
declare function mixBar<T>(obj: T): T & Bar;
let fooBar: FooBar = mixBar({
fooProp: "frizzlebizzle"
}); | {
"end_byte": 228,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/errorMessagesIntersectionTypes01.ts"
} |
TypeScript/tests/cases/compiler/catchClauseWithInitializer1.ts_0_25 | try {
}
catch (e = 1) {
} | {
"end_byte": 25,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/catchClauseWithInitializer1.ts"
} |
TypeScript/tests/cases/compiler/metadataOfUnionWithNull.ts_0_568 | // @experimentalDecorators: true
// @emitDecoratorMetadata: true
function PropDeco(target: Object, propKey: string | symbol) { }
class A {
}
class B {
@PropDeco
x: "foo" | null;
@PropDeco
y: true | never;
@PropDeco
z: "foo" | undefined;
@PropDeco
a: null;
@PropDeco
b: never... | {
"end_byte": 568,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/metadataOfUnionWithNull.ts"
} |
TypeScript/tests/cases/compiler/jsEnumFunctionLocalNoCrash.ts_0_682 | // @noEmit: true
// @checkJs: true
// @allowJs: true
// @filename: index.js
function defineCommonExtensionSymbols(apiPrivate) {
/** @enum {string} */
apiPrivate.Events = {
ButtonClicked: 'button-clicked-',
PanelObjectSelected: 'panel-objectSelected-',
NetworkRequestFinished: 'network-request-f... | {
"end_byte": 682,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsEnumFunctionLocalNoCrash.ts"
} |
TypeScript/tests/cases/compiler/controlFlowUnionContainingTypeParameter1.ts_0_612 | // @strict: true
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/44814
class TestClass<T> {
typeguard(val: unknown): val is T {
return true;
}
f(v: number): void {}
h(v: T): void {}
func(val: T | number): void {
if (this.typeguard(val)) {
this.h(val);
return;
}
... | {
"end_byte": 612,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/controlFlowUnionContainingTypeParameter1.ts"
} |
TypeScript/tests/cases/compiler/mergedDeclarations6.ts_0_317 | // @module: amd
// @filename: a.ts
export class A {
protected protected: any;
protected setProtected(val: any) {
this.protected = val;
}
}
// @filename: b.ts
import {A} from './a';
declare module "./a" {
interface A { }
}
export class B extends A {
protected setProtected() {
}
} | {
"end_byte": 317,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mergedDeclarations6.ts"
} |
TypeScript/tests/cases/compiler/exportEqualsProperty2.ts_0_263 | // This test is just like exportDefaultProperty2, but with `export =`.
// @Filename: a.ts
class C {
static B: number;
}
namespace C {
export interface B { c: number }
}
export = C.B;
// @Filename: b.ts
import B = require("./a");
const x: B = { c: B };
| {
"end_byte": 263,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportEqualsProperty2.ts"
} |
TypeScript/tests/cases/compiler/exportAssignmentWithExportModifier.ts_3_49 | @module: commonjs
var x;
export export = x; | {
"end_byte": 49,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportAssignmentWithExportModifier.ts"
} |
TypeScript/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplateES6.ts_0_62 | //@target: es6
function f(...args: any[]): void {
}
f `
\
`; | {
"end_byte": 62,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplateES6.ts"
} |
TypeScript/tests/cases/compiler/typeNamedUndefined2.ts_0_433 | // @strict: true
// @target: esnext
// @lib: esnext
export namespace ns {
export namespace undefined {
export const s = Symbol();
export type undefined = typeof s;
};
export function x(p: undefined): undefined {
return p;
}
}
export function x(p: ns.undefined.undefined) {
r... | {
"end_byte": 433,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeNamedUndefined2.ts"
} |
TypeScript/tests/cases/compiler/typeInferenceWithExcessProperties.ts_0_340 | // Repro from #17041
interface Named {
name: string;
}
function parrot<T extends Named>(obj: T): T {
return obj;
}
parrot({
name: "TypeScript",
});
parrot({
name: "TypeScript",
age: 5,
});
parrot({
name: "TypeScript",
age: function () { },
});
parrot({
name: "TypeScript",
sayH... | {
"end_byte": 340,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeInferenceWithExcessProperties.ts"
} |
TypeScript/tests/cases/compiler/nestedRedeclarationInES6AMD.ts_0_104 | // @target: ES6
// @module: AMD
function a() {
{
let status = 1;
status = 2;
}
} | {
"end_byte": 104,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedRedeclarationInES6AMD.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitUnknownImport.ts_0_105 | // @target: es5
// @module: commonjs
// @declaration: true
import Foo = SomeNonExistingName
export {Foo} | {
"end_byte": 105,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitUnknownImport.ts"
} |
TypeScript/tests/cases/compiler/typePredicatesOptionalChaining3.ts_0_522 | // @strict: true
interface Animal {
breed?: Breed;
}
interface Breed {
size?: string;
}
declare function isNil(value: unknown): value is undefined | null;
function getBreedSizeWithoutFunction(animal: Animal): string | undefined {
if (animal?.breed?.size != null) {
return animal.breed.size;
} else {
r... | {
"end_byte": 522,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typePredicatesOptionalChaining3.ts"
} |
TypeScript/tests/cases/compiler/scopeTests.ts_0_178 | class C { private v; public p; static s; }
class D extends C {
public v: number;
public p: number
constructor() {
super()
this.v = 1;
this.p = 1;
C.s = 1;
}
} | {
"end_byte": 178,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/scopeTests.ts"
} |
TypeScript/tests/cases/compiler/constDeclarations-scopes2.ts_0_181 | // @target: ES6
// global
const c = "string";
var n: number;
var b: boolean;
// for scope
for (const c = 0; c < 10; n = c ) {
// for block
const c = false;
b = c;
}
| {
"end_byte": 181,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constDeclarations-scopes2.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationTypeAliasSyntax.ts_0_48 | // @allowJs: true
// @filename: a.js
type a = b; | {
"end_byte": 48,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationTypeAliasSyntax.ts"
} |
TypeScript/tests/cases/compiler/indirectSelfReferenceGeneric.ts_0_55 | class a<T> extends b<T> { }
class b<T> extends a<T> { } | {
"end_byte": 55,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indirectSelfReferenceGeneric.ts"
} |
TypeScript/tests/cases/compiler/exportAssignmentWithDeclareModifier.ts_3_50 | @module: commonjs
var x;
declare export = x; | {
"end_byte": 50,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportAssignmentWithDeclareModifier.ts"
} |
TypeScript/tests/cases/compiler/recursiveLetConst.ts_0_317 | // @target:es6
'use strict'
let x = x + 1;
let [x1] = x1 + 1;
const y = y + 2;
const [y1] = y1 + 1;
for (let v = v; ; ) { }
for (let [v] = v; ;) { }
for (let v in v) { }
for (let v of v) { }
for (let [v] of v) { }
let [x2 = x2] = []
let z0 = () => z0;
let z1 = function () { return z1; }
let z2 = { f() { return z2;}} | {
"end_byte": 317,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveLetConst.ts"
} |
TypeScript/tests/cases/compiler/typeParameterFixingWithContextSensitiveArguments4.ts_0_215 | function f<T, U>(y: T, y1: U, p: (z: U) => T, p1: (x: T) => U): [T, U] { return [y, p1(y)]; }
interface A { a: A; }
interface B extends A { b; }
var a: A, b: B;
var d = f(a, b, x => x, x => <any>x); // Type [A, B] | {
"end_byte": 215,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParameterFixingWithContextSensitiveArguments4.ts"
} |
TypeScript/tests/cases/compiler/targetTypeTest2.ts_0_244 | // Test target typing for array literals and call expressions
var a : any[] = [1,2,"3"];
function func1(stuff:any[]) { return stuff; }
function func2(stuff1:string, stuff2:number, stuff3:number) {
return func1([stuff1, stuff2, stuff3]);
} | {
"end_byte": 244,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/targetTypeTest2.ts"
} |
TypeScript/tests/cases/compiler/importHelpersAmd.ts_0_941 | // @importHelpers: true
// @target: es5
// @module: amd
// @filename: a.ts
export class A { }
// @filename: b.ts
import { A } from "./a";
export * from "./a";
export class B extends A { }
// @filename: tslib.d.ts
export declare function __extends(d: Function, b: Function): void;
export declare function __assign(t: an... | {
"end_byte": 941,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersAmd.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitInvalidReference.ts_0_88 | // @declaration: true
// @noresolve: true
/// <reference path="invalid.ts" />
var x = 0; | {
"end_byte": 88,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitInvalidReference.ts"
} |
TypeScript/tests/cases/compiler/optionsTsBuildInfoFileWithoutIncrementalAndComposite.ts_0_71 | // @tsBuildInfoFile: /a/tsconfig.tsbuildinfo
const x = "Hello World";
| {
"end_byte": 71,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/optionsTsBuildInfoFileWithoutIncrementalAndComposite.ts"
} |
TypeScript/tests/cases/compiler/recursiveInheritanceGeneric.ts_0_52 | interface I5<T> extends I5<T> {
foo():void;
} | {
"end_byte": 52,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveInheritanceGeneric.ts"
} |
TypeScript/tests/cases/compiler/argumentsObjectIterator03_ES6.ts_0_165 | //@target: ES6
function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] {
let [x, y, z] = arguments;
return [z, y, x];
}
| {
"end_byte": 165,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/argumentsObjectIterator03_ES6.ts"
} |
TypeScript/tests/cases/compiler/letConstInCaseClauses.ts_0_411 | // @target: es5
var x = 10;
var y = 20;
{
let x = 1;
let y = 2;
console.log(x)
switch (x) {
case 10:
let x = 20;
}
switch (y) {
case 10:
let y = 20;
}
}
{
const x = 1;
const y = 2;
console.log(x)
switch (x) {
case 10:
... | {
"end_byte": 411,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/letConstInCaseClauses.ts"
} |
TypeScript/tests/cases/compiler/importDeclWithExportModifier.ts_0_85 | //@module: amd
module x {
interface c {
}
}
export import a = x.c;
var b: a;
| {
"end_byte": 85,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importDeclWithExportModifier.ts"
} |
TypeScript/tests/cases/compiler/objectLiteralWithSemicolons4.ts_0_15 | var v = {
a
; | {
"end_byte": 15,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectLiteralWithSemicolons4.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationLetBeingRenamed.ts_0_143 | // @allowJs: true
// @outFile: out.js
// @FileName: a.js
function foo(a) {
for (let a = 0; a < 10; a++) {
// do something
}
}
| {
"end_byte": 143,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationLetBeingRenamed.ts"
} |
TypeScript/tests/cases/compiler/assignmentCompatability38.ts_0_357 | 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:{ new <Tstring>(param: Tstring); };;
export var __val__aa = aa;
}
__test... | {
"end_byte": 357,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability38.ts"
} |
TypeScript/tests/cases/compiler/substituteReturnTypeSatisfiesConstraint.ts_0_143 | type M = { p: string };
type O = { m: () => M };
type X<T extends M> = T;
type FFG<T> = T extends O ? X<ReturnType<T['m']>> : never; // error!
| {
"end_byte": 143,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/substituteReturnTypeSatisfiesConstraint.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitObjectLiteralAccessorsJs1.ts_0_801 | // @strict: true
// @checkJs: true
// @declaration: true
// @emitDeclarationOnly: true
// @filename: index.js
// same type accessors
export const obj1 = {
/**
* my awesome getter (first in source order)
* @returns {string}
*/
get x() {
return "";
},
/**
* my awesome setter (second in source or... | {
"end_byte": 801,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitObjectLiteralAccessorsJs1.ts"
} |
TypeScript/tests/cases/compiler/nondistributiveConditionalTypeInfer.ts_0_397 | type _R<T> = [T] extends [{ _R: (_: infer R) => void }] ? R : never;
type _E<T> = [T] extends [{ _E: () => infer E }] ? E : never;
type _A<T> = [T] extends [{ _A: () => infer A }] ? A : never;
interface Sync<R, E, A> {
_R: (_: R) => void;
_E: () => E;
_A: () => A;
}
type R = _R<Sync<number, string, void>>;
type... | {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nondistributiveConditionalTypeInfer.ts"
} |
TypeScript/tests/cases/compiler/overloadReturnTypes.ts_0_505 | class Accessor {}
function attr(name: string): string;
function attr(name: string, value: string): Accessor;
function attr(map: any): Accessor;
function attr(nameOrMap: any, value?: string): any {
if (nameOrMap && typeof nameOrMap === "object") {
// handle map case
return new Accessor;
}
el... | {
"end_byte": 505,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadReturnTypes.ts"
} |
TypeScript/tests/cases/compiler/functionOverloads16.ts_0_135 | function foo(foo:{a:string;}):string;
function foo(foo:{a:string;}):number;
function foo(foo:{a:string; b?:number;}):any { return "" }
| {
"end_byte": 135,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads16.ts"
} |
TypeScript/tests/cases/compiler/usedImportNotElidedInJs.ts_0_268 | // #38412
// @allowJs: true
// @noResolve: true
// @target: es2015
// @outDir: out
// @noTypesAndSymbols: true
// @Filename: test.js
import * as moment from 'moment';
import rollupMoment__default from 'moment';
export const moment = rollupMoment__default || moment;
| {
"end_byte": 268,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/usedImportNotElidedInJs.ts"
} |
TypeScript/tests/cases/compiler/useBeforeDeclaration_classDecorators.1.ts_0_1378 | // @target: esnext
// @noEmit: true
// @noTypesAndSymbols: true
declare const dec: any;
// ok
@dec(() => C1) class C1 { }
// error
@dec(C2) class C2 { }
// error
@dec((() => C3)()) class C3 { }
// ok
class C4 {
@dec(() => C4) static method() {}
@dec(() => C4) static get x() { return this.y; }
@dec(() =... | {
"end_byte": 1378,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/useBeforeDeclaration_classDecorators.1.ts"
} |
TypeScript/tests/cases/compiler/enumBasics3.ts_0_237 | module M {
export namespace N {
export enum E1 {
a = 1,
b = a.a, // should error
}
}
}
module M {
export namespace N {
export enum E2 {
b = M.N.E1.a,
c = M.N.E1.a.a, // should error
}
}
}
| {
"end_byte": 237,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumBasics3.ts"
} |
TypeScript/tests/cases/compiler/functionTypeArgumentArrayAssignment.ts_0_144 | module test {
interface Array<T> {
foo: T;
length: number;
}
function map<U>() {
var ys: U[] = [];
}
}
| {
"end_byte": 144,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionTypeArgumentArrayAssignment.ts"
} |
TypeScript/tests/cases/compiler/usingModuleWithExportImportInValuePosition.ts_0_382 | module A {
export var x = 'hello world'
export class Point {
constructor(public x: number, public y: number) { }
}
export module B {
export interface Id {
name: string;
}
}
}
module C {
export import a = A;
}
var a: string = C.a.x;
var b: { x: number; y: number; } = ... | {
"end_byte": 382,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/usingModuleWithExportImportInValuePosition.ts"
} |
TypeScript/tests/cases/compiler/exportAssignmentWithExports.ts_0_62 | //@module: commonjs
export class C { }
class D { }
export = D; | {
"end_byte": 62,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportAssignmentWithExports.ts"
} |
TypeScript/tests/cases/compiler/intersectionPropertyCheck.ts_0_543 | // @strict: true
let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
declare let wrong: { a: { y: string } };
let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
function foo<T extends object>(x: { a?: string }, y: T & { a: ... | {
"end_byte": 543,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/intersectionPropertyCheck.ts"
} |
TypeScript/tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts_0_186 | declare function trans<T>(f: (x: T) => string): number;
trans(({a}) => a);
trans(([b,c]) => 'foo');
trans(({d: [e,f]}) => 'foo');
trans(([{g},{h}]) => 'foo');
trans(({a, b = 10}) => a);
| {
"end_byte": 186,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts"
} |
TypeScript/tests/cases/compiler/reExportUndefined1.ts_0_62 | // @module: commonjs
// @filename: a.ts
export { undefined }; | {
"end_byte": 62,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reExportUndefined1.ts"
} |
TypeScript/tests/cases/compiler/destructuringWithNumberLiteral.ts_0_26 | var { toExponential } = 0; | {
"end_byte": 26,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructuringWithNumberLiteral.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitDefaultExport3.ts_0_85 | // @declaration: true
// @target: es6
export default function foo() {
return ""
} | {
"end_byte": 85,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitDefaultExport3.ts"
} |
TypeScript/tests/cases/compiler/noSubstitutionTemplateStringLiteralTypes.ts_0_24 | const x: `foo` = "foo";
| {
"end_byte": 24,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noSubstitutionTemplateStringLiteralTypes.ts"
} |
TypeScript/tests/cases/compiler/conditionallyDuplicateOverloadsCausedByOverloadResolution.ts_0_545 | declare function foo(func: (x: string, y: string) => any): boolean;
declare function foo(func: (x: string, y: number) => any): string;
var out = foo((x, y) => {
function bar(a: typeof x): void;
function bar(b: typeof y): void;
function bar() { }
return bar;
});
declare function foo2(func: (x: string, ... | {
"end_byte": 545,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionallyDuplicateOverloadsCausedByOverloadResolution.ts"
} |
TypeScript/tests/cases/compiler/exportArrayBindingPattern.ts_0_128 | // @module: commonjs
// issue: https://github.com/Microsoft/TypeScript/issues/10778
const [a, , b] = [1, 2, 3];
export { a, b }; | {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportArrayBindingPattern.ts"
} |
TypeScript/tests/cases/compiler/complicatedIndexesOfIntersectionsAreInferencable.ts_0_724 | // @strict: true
interface FormikConfig<Values> {
initialValues: Values;
validate?: (props: Values) => void;
validateOnChange?: boolean;
}
declare function Func<Values = object, ExtraProps = {}>(
x: (string extends "validate" | "initialValues" | keyof ExtraProps
? Readonly<FormikConfig<Values> ... | {
"end_byte": 724,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complicatedIndexesOfIntersectionsAreInferencable.ts"
} |
TypeScript/tests/cases/compiler/autolift3.ts_0_477 | class B {
constructor() {
function foo() { }
foo();
var a = 0;
var inner: any = (function() {
var CScriptIO = (function() {
var fso = 0
return {
readFile: function(path: string): string {
ret... | {
"end_byte": 477,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/autolift3.ts"
} |
TypeScript/tests/cases/compiler/functionWithSameNameAsField.ts_0_141 | class TestProgressBar {
public total: number;
public total(total: number) {
this.total = total;
return this;
}
}
| {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionWithSameNameAsField.ts"
} |
TypeScript/tests/cases/compiler/genericFunctions0.ts_0_108 | // @declaration: true
function foo<T > (x: T) { return x; }
var x = foo<number>(5); // 'x' should be number | {
"end_byte": 108,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericFunctions0.ts"
} |
TypeScript/tests/cases/compiler/aliasUsageInIndexerOfClass.ts_0_752 | // @module: commonjs
// @Filename: aliasUsageInIndexerOfClass_backbone.ts
export class Model {
public someData: string;
}
// @Filename: aliasUsageInIndexerOfClass_moduleA.ts
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
export class VisualizationModel extends Backbone.Model {
// interesti... | {
"end_byte": 752,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/aliasUsageInIndexerOfClass.ts"
} |
TypeScript/tests/cases/compiler/wrappedIncovations1.ts_0_40 | var v = this
.foo()
.bar()
.baz(); | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/wrappedIncovations1.ts"
} |
TypeScript/tests/cases/compiler/es6ExportAllInEs5.ts_0_271 | // @target: es5
// @module: commonjs
// @declaration: true
// @filename: server.ts
export class c {
}
export interface i {
}
export module m {
export var x = 10;
}
export var x = 10;
export module uninstantiated {
}
// @filename: client.ts
export * from "./server"; | {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ExportAllInEs5.ts"
} |
TypeScript/tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts_0_219 | // @target: ES5
function foo() {
for (const i of [0, 1]) {
if (i === 0) {
continue;
}
// Trigger non-simple-loop emit
(() => {
return i;
})();
}
} | {
"end_byte": 219,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts"
} |
TypeScript/tests/cases/compiler/noReachabilityErrorsOnEmptyStatement.ts_0_33 | function foo() {
return 1;;
} | {
"end_byte": 33,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noReachabilityErrorsOnEmptyStatement.ts"
} |
TypeScript/tests/cases/compiler/genericInterfaceTypeCall.ts_0_345 | interface Foo<T> {
reject(arg: T): void;
}
var foo: Foo<string>
interface bar<T> {
fail(func: (arg: T) => void ): void;
fail2(func2: { (arg: T): void; }): void;
}
var test: bar<string>;
test.fail(arg => foo.reject(arg));
test.fail2(arg => foo.reject(arg)); // Error: Supplied parameters do not match any ... | {
"end_byte": 345,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericInterfaceTypeCall.ts"
} |
TypeScript/tests/cases/compiler/parseErrorIncorrectReturnToken.ts_1_314 | type F1 = {
(n: number) => string; // should be : not =>
}
type F2 = (n: number): string; // should be => not :
// doesn't work in non-type contexts, where the return type is optional
let f = (n: number) => string => n.toString();
let o = {
m(n: number) => string {
return n.toString();
}
};
| {
"end_byte": 314,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseErrorIncorrectReturnToken.ts"
} |
TypeScript/tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts_0_112 | interface Foo {
f(x: any): any;
}
interface Bar {
f<T>(x: T): T;
}
interface Hello extends Foo, Bar {
}
| {
"end_byte": 112,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts"
} |
TypeScript/tests/cases/compiler/interfacePropertiesWithSameName3.ts_0_182 | interface D { a: number; }
interface E { a: string; }
interface F extends E, D { } // error
class D2 { a: number; }
class E2 { a: string; }
interface F2 extends E2, D2 { } // error
| {
"end_byte": 182,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/interfacePropertiesWithSameName3.ts"
} |
TypeScript/tests/cases/compiler/defaultValueInFunctionTypes.ts_0_140 | type Foo = ({ first = 0 }: { first?: number }) => unknown;
var x: (a: number = 1) => number;
var y = <(a : string = "") => any>(undefined)
| {
"end_byte": 140,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/defaultValueInFunctionTypes.ts"
} |
TypeScript/tests/cases/compiler/circularGetAccessor.ts_0_84 | // @noImplicitAny: true, false
declare class C {
get foo(): typeof this.foo;
}
| {
"end_byte": 84,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/circularGetAccessor.ts"
} |
TypeScript/tests/cases/compiler/tslibInJs.ts_0_244 | // @checkJs: true
// @allowJs: true
// @moduleResolution: node
// @target: es2018
// @module: commonjs
// @importHelpers: true
// @lib: es2018
// @outDir: out
// @noEmit: true
// @fileName: main.js
"use strict";
const { foo } = require("bar"); | {
"end_byte": 244,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/tslibInJs.ts"
} |
TypeScript/tests/cases/compiler/importAliasInModuleAugmentation.ts_0_247 | export { }
namespace A {
export const y = 34;
export interface y { s: string }
}
declare global {
export import x = A.y;
// Should still error
import f = require("fs");
}
const m: number = x;
let s: x = { s: "" };
void s.s; | {
"end_byte": 247,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importAliasInModuleAugmentation.ts"
} |
TypeScript/tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts_0_171 | //@noUnusedLocals:true
//@noUnusedParameters:true
function greeter(person: string, person2: string, person3: string) {
var unused = 20;
person2 = "dummy value";
} | {
"end_byte": 171,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts"
} |
TypeScript/tests/cases/compiler/recursiveFunctionTypes.ts_0_930 | function fn(): typeof fn { return 1; }
var x: number = fn; // error
var y: () => number = fn; // ok
var f: () => typeof g;
var g: () => typeof f;
function f1(d: typeof f1) { }
function f2(): typeof g2 { }
function g2(): typeof f2 { }
interface I<T> { }
function f3(): I<typeof f3> { return f3; }
var a: number = ... | {
"end_byte": 930,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveFunctionTypes.ts"
} |
TypeScript/tests/cases/compiler/importedAliasedConditionalTypeInstantiation.ts_0_1649 | // @filename: node_modules/aws-lambda/index.d.ts
export type Handler<TEvent = any, TResult = any> = (
event: TEvent,
context: {},
callback: Callback<TResult>,
) => void | Promise<TResult>;
export type Callback<TResult = any> = (error?: Error | string | null, result?: TResult) => void;
// @filename: node_m... | {
"end_byte": 1649,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importedAliasedConditionalTypeInstantiation.ts"
} |
TypeScript/tests/cases/compiler/APISample_watcher.ts_3_4523 | @module: commonjs
// @skipLibCheck: true
// @noImplicitAny:true
// @strictNullChecks:true
// @noTypesAndSymbols: true
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}
// @filename: APISample_watcher.ts
/*
* Note: This test is a public API sample. T... | {
"end_byte": 4523,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/APISample_watcher.ts"
} |
TypeScript/tests/cases/compiler/conditionalTypeVarianceBigArrayConstraintsPerformance.ts_0_247 | // @skipLibCheck: true
/// <reference path="/.lib/react16.d.ts" />
type Stuff<T> =
T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: any;
function F<T, U>(p1: Stuff<T>, p2: Stuff<U>) {
p1 = p2; // Error
} | {
"end_byte": 247,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionalTypeVarianceBigArrayConstraintsPerformance.ts"
} |
TypeScript/tests/cases/compiler/controlFlowDestructuringParameters.ts_0_82 | // Repro for #8376
// @strictNullChecks: true
[{ x: 1 }].map(
({ x }) => x
);
| {
"end_byte": 82,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/controlFlowDestructuringParameters.ts"
} |
TypeScript/tests/cases/compiler/classExtendingQualifiedName.ts_0_65 | module M {
class C {
}
class D extends M.C {
}
} | {
"end_byte": 65,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExtendingQualifiedName.ts"
} |
TypeScript/tests/cases/compiler/typeReferenceDirectiveScopedPackageCustomTypeRoot.ts_0_1012 | // @noImplicitReferences: true
// @typeRoots: /types,/node_modules,/node_modules/@types
// @types: @scoped/typescache,@scoped/nodemodulescache,@scoped/attypescache,@mangled/typescache,@mangled/nodemodulescache,@mangled/attypescache
// @traceResolution: true
// @currentDirectory: /
// @Filename: /types/@scoped/typescac... | {
"end_byte": 1012,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeReferenceDirectiveScopedPackageCustomTypeRoot.ts"
} |
TypeScript/tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts_1_1604 | for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break;
}
else {
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
break;
}
else {
y++;
... | {
"end_byte": 1604,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts"
} |
TypeScript/tests/cases/compiler/extendAndImplementTheSameBaseType.ts_0_145 | class C {
foo: number
bar() {}
}
class D extends C implements C {
baz() { }
}
var c: C;
var d: D = new D();
d.bar();
d.baz();
d.foo; | {
"end_byte": 145,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/extendAndImplementTheSameBaseType.ts"
} |
TypeScript/tests/cases/compiler/jsdocTypedefNoCrash.ts_0_127 | // @target: es6
// @allowJs: true
// @outDir: ./dist
// @filename: export.js
/**
* @typedef {{
* }}
*/
export const foo = 5; | {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocTypedefNoCrash.ts"
} |
TypeScript/tests/cases/compiler/extendNonClassSymbol1.ts_0_89 | class A { foo() { } }
var x = A;
class C extends x { } // error, could not find symbol xs | {
"end_byte": 89,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/extendNonClassSymbol1.ts"
} |
TypeScript/tests/cases/compiler/keepImportsInDts2.ts_0_123 | // @module: amd
// @declaration: true
// @filename: folder/test.ts
export {};
// @filename: main.ts
import "./folder/test" | {
"end_byte": 123,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/keepImportsInDts2.ts"
} |
TypeScript/tests/cases/compiler/circularModuleImports.ts_0_57 | module M
{
import A = B;
import B = A;
}
| {
"end_byte": 57,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/circularModuleImports.ts"
} |
TypeScript/tests/cases/compiler/multiExtendsSplitInterfaces1.ts_0_29 | self.cancelAnimationFrame(0); | {
"end_byte": 29,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/multiExtendsSplitInterfaces1.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.ts_0_168 | // @allowJs: true
// @outFile: out.js
// @declaration: true
// @filename: a.ts
function foo() {
return 30;
}
// @filename: b.js
function foo() {
return 10;
}
| {
"end_byte": 168,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.ts"
} |
TypeScript/tests/cases/compiler/es6ImportNameSpaceImportWithExport.ts_0_271 | // @module: amd
// @declaration: true
// @filename: server.ts
export var a = 10;
// @filename: client.ts
export import * as nameSpaceBinding from "server";
export var x = nameSpaceBinding.a;
export import * as nameSpaceBinding2 from "server"; // Not referenced imports
| {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportNameSpaceImportWithExport.ts"
} |
TypeScript/tests/cases/compiler/privacyTypeParametersOfInterface.ts_0_2075 | // @module: commonjs
class privateClass {
}
export class publicClass {
}
class privateClassT<T> {
}
export class publicClassT<T> {
}
// TypeParameter_0_of_exported_interface_1_has_or_is_using_private_type_2
export interface publicInterfaceWithPrivateTypeParameters<T extends privateClass> {
myMethod(val: T): T; ... | {
"end_byte": 2075,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyTypeParametersOfInterface.ts"
} |
TypeScript/tests/cases/compiler/functionOverloads22.ts_0_150 | function foo(bar:number):{a:number;}[];
function foo(bar:string):{a:number; b:string;}[];
function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] }
| {
"end_byte": 150,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads22.ts"
} |
TypeScript/tests/cases/compiler/emptyGenericParamList.ts_0_25 | class I<T> {}
var x: I<>; | {
"end_byte": 25,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emptyGenericParamList.ts"
} |
TypeScript/tests/cases/compiler/propertyOrdering.ts_0_468 | class Foo {
constructor(store: string) { }
public foo() {
return this._store.length; // shouldn't be an error
}
public _store = store; // no repro if this is first line in class body
public bar() { return this.store; } // should be an error
}
class Bar {
public foo() ... | {
"end_byte": 468,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propertyOrdering.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationRestParamJsDocFunction.ts_0_842 | // @allowJs: true
// @outFile: apply.js
// @module: amd
// @filename: _apply.js
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `... | {
"end_byte": 842,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationRestParamJsDocFunction.ts"
} |
TypeScript/tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts_0_348 | // @noImplicitReferences: true
// @traceResolution: true
// This tests that a package.json "main" with an unexpected extension is ignored.
// @Filename: /node_modules/normalize.css/normalize.css
This file is not read.
// @Filename: /node_modules/normalize.css/package.json
{ "main": "normalize.css" }
// @Filename: /a... | {
"end_byte": 348,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts"
} |
TypeScript/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts_3_383 | @removeComments: true
function foo1() {
// Single line comment
return 42;
}
function foo2() {
/*
multi line
comment
*/
return 42;
}
function foo3() {
// Single line comment with more than one blank line
return 42;
}
function foo4() {
/*
multi line commen... | {
"end_byte": 383,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts"
} |
TypeScript/tests/cases/compiler/isolatedModulesSketchyAliasLocalMerge.ts_0_331 | // @isolatedModules: false, true
// @verbatimModuleSyntax: false, true
// @noEmit: true
// @noTypesAndSymbols: true
// @Filename: types.ts
export type FC = () => void;
// @Filename: bad.ts
import { FC } from "./types";
let FC: FC | null = null;
// @Filename: good.ts
import type { FC } from "./types";
let FC: FC | nu... | {
"end_byte": 331,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesSketchyAliasLocalMerge.ts"
} |
TypeScript/tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts_0_200 | // @target: es6
// This should be an error
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
var let = 10;
for (let of [1,2,3]) {}
for (let in [1,2,3]) {}
| {
"end_byte": 200,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationWithoutOut.ts_0_88 | // @allowJs: true
// @filename: a.ts
class c {
}
// @filename: b.js
function foo() {
}
| {
"end_byte": 88,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationWithoutOut.ts"
} |
TypeScript/tests/cases/compiler/typeOfYieldWithUnionInContextualReturnType.ts_0_1029 | // @target: esnext
// https://github.com/microsoft/TypeScript/issues/42439
type SyncSequenceFactory = () => Generator<string, string, string>;
type AsyncSequenceFactory = () => AsyncGenerator<string, string, string>;
type SequenceFactory = SyncSequenceFactory | AsyncSequenceFactory
const syncFactory: SyncSequenceFa... | {
"end_byte": 1029,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeOfYieldWithUnionInContextualReturnType.ts"
} |
TypeScript/tests/cases/compiler/typeLiteralCallback.ts_0_367 | interface Foo<T> {
reject(arg: T): void ;
}
var foo: Foo<string>
interface bar<T> {
fail(func: (arg: T) => void ): void ;
fail2(func: { (arg: T): void ; }): void ;
}
var test: bar<string>;
test.fail(arg => foo.reject(arg));
test.fail2(arg => foo.reject(arg)); // Should be OK. Was: Error: Supplied parame... | {
"end_byte": 367,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeLiteralCallback.ts"
} |
TypeScript/tests/cases/compiler/commentsOnObjectLiteral5.ts_0_158 | // @removeComments: false
// @target: ES5
const a = {
p0: 0, // Comment 0
p1: 0, /* Comment 1
A multiline comment. */
p2: 0, // Comment 2
};
| {
"end_byte": 158,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsOnObjectLiteral5.ts"
} |
TypeScript/tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx_0_923 | // @jsx: react
/// <reference path="/.lib/react16.d.ts" />
import * as React from "react";
interface MyProps {
x: number;
}
function MyComp4(props: MyProps, context: any, bad: any, verybad: any) {
return <div></div>;
}
function MyComp3(props: MyProps, context: any, bad: any) {
return <div></div>;
}
funct... | {
"end_byte": 923,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx"
} |
TypeScript/tests/cases/compiler/ClassDeclaration8.ts_0_28 | class C {
constructor();
} | {
"end_byte": 28,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ClassDeclaration8.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.