_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/compiler/propertyWrappedInTry.ts_0_185 | class Foo {
try {
public bar = someInitThatMightFail();
} catch(e) {}
public baz() {
return this.bar; // doesn't get rewritten to Foo.bar.
}
}
| {
"end_byte": 185,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propertyWrappedInTry.ts"
} |
TypeScript/tests/cases/compiler/emitOneLineVariableDeclarationRemoveCommentsFalse.ts_0_303 | // @removeComments: false
let a = /*[[${something}]]*/ {};
let b: any = /*[[${something}]]*/ {};
let c: { hoge: boolean } = /*[[${something}]]*/ { hoge: true };
let d: any /*[[${something}]]*/ = {};
let e/*[[${something}]]*/: any = {};
let f = /* comment1 */ d(e);
let g: any = /* comment2 */ d(e);
| {
"end_byte": 303,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emitOneLineVariableDeclarationRemoveCommentsFalse.ts"
} |
TypeScript/tests/cases/compiler/numberLiteralsWithLeadingZeros.ts_0_648 | 00;
000;
01;
001;
08;
008;
00.5;
000.5;
01.5;
001.5;
08.5;
008.5;
00e5;
000e5;
01e5;
001e5;
08e5;
008e5;
00.5e5;
000.5e5;
01.5e5;
001.5e5;
08.5e5;
008.5e5;
00.5_5;
000.5_5;
01.5_5;
001.5_5;
08.5_5;
008.5_5;
00e5_5;
000e5_5;
01e5_5;
001e5_5;
08e5_5;
008e5_5;
00.5_5e5_5;
000.5_5e5_5;
01.5_5e5_5;
001.5_5e5_5;
08.5_5... | {
"end_byte": 648,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/numberLiteralsWithLeadingZeros.ts"
} |
TypeScript/tests/cases/compiler/importHelpersNoModule.ts_0_441 | // @importHelpers: true
// @target: es5
// @module: commonjs
// @moduleResolution: classic
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @filename: external.ts
export class A { }
export class B extends A { }
declare var dec: any;
@dec
class C {
method(@dec x: number) {
}
}
// @filename:... | {
"end_byte": 441,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersNoModule.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitExpressionInExtends6.ts_0_324 | // @module: commonjs
// @declaration: true
// @allowJs: true
// @types: node
// @currentDirectory: /
// @Filename: /node_modules/@types/node/index.d.ts
declare const require: any;
// @Filename: /a.ts
export class Foo {}
// @Filename: /b.ts
import * as A from "./a";
const { Foo } = A;
export default class extends Foo... | {
"end_byte": 324,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitExpressionInExtends6.ts"
} |
TypeScript/tests/cases/compiler/inferSetterParamType.ts_0_294 | class Foo {
get bar() {
return 0;
}
set bar(n) { // should not be an error - infer number
}
}
class Foo2 {
get bar() {
return 0; // should be an error - can't coerce infered return type to match setter annotated type
}
set bar(n:string) {
}
}
| {
"end_byte": 294,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferSetterParamType.ts"
} |
TypeScript/tests/cases/compiler/contextualTyping30.ts_0_46 | function foo(param:number[]){}; foo([1, "a"]); | {
"end_byte": 46,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTyping30.ts"
} |
TypeScript/tests/cases/compiler/destructuringInVariableDeclarations7.ts_0_93 | // @target: es6
// @module: system
export let { toString } = 1;
{
let { toFixed } = 1;
}
| {
"end_byte": 93,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructuringInVariableDeclarations7.ts"
} |
TypeScript/tests/cases/compiler/jsdocIllegalTags.ts_0_192 | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: /a.js
class C {
/** @template T */
constructor() { }
}
class D {
/** @return {number} */
constructor() {}
}
| {
"end_byte": 192,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocIllegalTags.ts"
} |
TypeScript/tests/cases/compiler/promiseAllOnAny01.ts_0_160 | // @noEmit: true
// @lib: es5,es2015.promise
async function foo(x: any) {
let abc = await Promise.all(x);
let result: any[] = abc;
return result;
} | {
"end_byte": 160,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/promiseAllOnAny01.ts"
} |
TypeScript/tests/cases/compiler/quickinfoTypeAtReturnPositionsInaccurate.ts_0_2817 | class NumClass<T extends number> {
private value!: T;
public get(): T {
return this.value;
}
public numExclusive() { }
}
class StrClass<T extends string> {
private value!: T;
public get(): T {
return this.value;
}
public strExclusive() { }
}
const isNumClass = <Item ext... | {
"end_byte": 2817,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/quickinfoTypeAtReturnPositionsInaccurate.ts"
} |
TypeScript/tests/cases/compiler/unusedLocalsInMethod3.ts_0_132 | //@noUnusedLocals:true
//@noUnusedParameters:true
class greeter {
public function1() {
var x, y;
y = 1;
}
} | {
"end_byte": 132,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedLocalsInMethod3.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitPathMappingMonorepo.ts_0_605 | // @filename: packages/a/index.d.ts
declare module "@ts-bug/a" {
export type AText = {
value: string;
};
export function a(text: string): AText;
}
// @filename: packages/b/src/index.ts
import { a } from "@ts-bug/a";
export function b(text: string) {
return a(text);
}
// @filename: packages/b/t... | {
"end_byte": 605,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitPathMappingMonorepo.ts"
} |
TypeScript/tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts_0_661 | // @noEmit: true
// @lib: esnext
// repro #49646
type EnvFunction = <T>() => T;
type SimpleType = string | Promise<SimpleType>;
declare const simple: SimpleType;
const env: EnvFunction = () => simple;
// repro #49723
type T1 = 1 | Promise<T1> | T1[];
export async function myFunction(param: T1) {
const awaited... | {
"end_byte": 661,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts"
} |
TypeScript/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts_0_493 | // @noemithelpers: true
// @experimentaldecorators: true
// @emitdecoratormetadata: true
// @target: es5
// @module: commonjs
// @filename: db.ts
export class db {
public doSomething() {
}
}
// @filename: service.ts
import {db as Database} from './db';
function someDecorator(target) {
return target;
}
@som... | {
"end_byte": 493,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts_0_5514 | // @strict: true
// @declaration: true
// @module: nodenext
// @moduleResolution: nodenext
// @target: esnext
// @filename: node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts
type QueryKey = ReadonlyArray<unknown>;
interface Register {}
type DefaultError = Register extends {
defaultError: infer T... | {
"end_byte": 5514,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts"
} |
TypeScript/tests/cases/compiler/classIndexer.ts_0_65 | class C123 {
[s: string]: number;
constructor() {
}
} | {
"end_byte": 65,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classIndexer.ts"
} |
TypeScript/tests/cases/compiler/propertyOverridingPrototype.ts_0_86 | class Base {
foo() {
}
}
class Derived extends Base {
foo: () => { };
}
| {
"end_byte": 86,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propertyOverridingPrototype.ts"
} |
TypeScript/tests/cases/compiler/superCallAssignResult.ts_0_165 | class E {
constructor(arg: any) { }
}
class H extends E {
constructor() {
var x = super(5); // Should be of type void, not E.
x = 5;
}
} | {
"end_byte": 165,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superCallAssignResult.ts"
} |
TypeScript/tests/cases/compiler/signatureCombiningRestParameters3.ts_0_1666 | // @strict: true
// @noEmit: true
interface ExtensionConfig<Options = any> {
extendMarkSchema?:
| ((
this: {
name: string;
options: Options;
},
extension: Mark,
) => Record<string, any>)
| null;
}
declare class Extension<Options = any> {
type: string;
na... | {
"end_byte": 1666,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/signatureCombiningRestParameters3.ts"
} |
TypeScript/tests/cases/compiler/fromAsIdentifier2.ts_0_23 | "use strict";
var from; | {
"end_byte": 23,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/fromAsIdentifier2.ts"
} |
TypeScript/tests/cases/compiler/exportClassExtendingIntersection.ts_0_940 | // @declaration: true
// @Filename:BaseClass.ts
export type Constructor<T> = new (...args: any[]) => T;
export class MyBaseClass<T> {
baseProperty: string;
constructor(value: T) {}
}
// @Filename:MixinClass.ts
import { Constructor, MyBaseClass } from './BaseClass';
export interface MyMixin {
mixinProperty... | {
"end_byte": 940,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportClassExtendingIntersection.ts"
} |
TypeScript/tests/cases/compiler/jsxSpreadFirstUnionNoErrors.tsx_0_499 | // @jsx: react
// @libFiles: lib.d.ts,react.d.ts
// @skipLibCheck: true
// @allowSyntheticDefaultImports: true
import React from "react";
type InfoProps =
| { status: "hidden" }
| { status: "visible"; content: string };
const Info = (props: InfoProps) =>
props.status === "hidden"
? <noscript />
: <div>{props.cont... | {
"end_byte": 499,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxSpreadFirstUnionNoErrors.tsx"
} |
TypeScript/tests/cases/compiler/typedGenericPrototypeMember.ts_0_108 | class List<T> {
add(item: T) { }
}
List.prototype.add("abc"); // Valid because T is instantiated to any
| {
"end_byte": 108,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typedGenericPrototypeMember.ts"
} |
TypeScript/tests/cases/compiler/numberAsInLHS.ts_0_11 | 3 in [0, 1] | {
"end_byte": 11,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/numberAsInLHS.ts"
} |
TypeScript/tests/cases/compiler/destructureCatchClause.ts_0_966 | // @strict: true, false
// @useUnknownInCatchVariables: true, false
// These are okay with useUnknownInCatchVariables=false, but not okay with useUnknownInCatchVariables=true.
try {} catch ({ x }) { x }
try {} catch ([ x ]) { x }
try {} catch ({ a: { x } }) { x }
try {} catch ({ a: [ x ] }) { x }
try {} catch ([{ x ... | {
"end_byte": 966,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructureCatchClause.ts"
} |
TypeScript/tests/cases/compiler/spreadIntersectionJsx.tsx_0_136 | // @jsx: react
const React: any = null;
class A { a; }
class C { c; }
let intersected: A & C;
let element = <div { ...intersected } />;
| {
"end_byte": 136,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spreadIntersectionJsx.tsx"
} |
TypeScript/tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExport.ts_0_296 | //@module: commonjs
// @declaration: true
export module x {
export class c {
foo(a: number) {
return a;
}
}
}
export module m2 {
export module m3 {
import c = x.c;
export var cProp = new c();
var cReturnVal = cProp.foo(10);
}
} | {
"end_byte": 296,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExport.ts"
} |
TypeScript/tests/cases/compiler/controlFlowPropertyInitializer.ts_0_117 | // @strictNullChecks: true
// Repro from #8967
const LANG = "Turbo Pascal"
class BestLanguage {
name = LANG;
} | {
"end_byte": 117,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/controlFlowPropertyInitializer.ts"
} |
TypeScript/tests/cases/compiler/jsdocTypecastNoTypeNoCrash.ts_0_112 | // @allowJS: true
// @outDir: ./out
// @filename: index.js
function Foo() {}
const a = /* @type string */(Foo);
| {
"end_byte": 112,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocTypecastNoTypeNoCrash.ts"
} |
TypeScript/tests/cases/compiler/forIn.ts_0_316 | var arr = null;
for (var i:number in arr) { // error
var x1 = arr[i];
var y1 = arr[i];
}
for (var j in arr) { // ok
var x2 = arr[j];
var y2 = arr[j];
}
var arr2 = [];
for (j in arr2) { // ok
var x3 = arr2[j];
var y3 = arr2[j];
}
for (var l in arr) {
// error in the body
k[l] = 1;
} | {
"end_byte": 316,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/forIn.ts"
} |
TypeScript/tests/cases/compiler/flowAfterFinally1.ts_0_253 | // @strictNullChecks: true
declare function openFile(): void
declare function closeFile(): void
declare function someOperation(): {}
var result: {}
openFile()
try {
result = someOperation()
} finally {
closeFile()
}
result // should not error here | {
"end_byte": 253,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/flowAfterFinally1.ts"
} |
TypeScript/tests/cases/compiler/contextualSignatureInstantiation2.ts_0_222 | // dot f g x = f(g(x))
var dot: <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (_: U) => S;
dot = <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T): (r:U) => S => (x) => f(g(x));
var id: <T>(x:T) => T;
var r23 = dot(id)(id); | {
"end_byte": 222,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualSignatureInstantiation2.ts"
} |
TypeScript/tests/cases/compiler/noEmitAndCompositeListFilesOnly.ts_0_174 | // @listFilesOnly: true
// @Filename: /a.ts
const x = 10;
// @Filename: /tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"composite": true
}
}
| {
"end_byte": 174,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noEmitAndCompositeListFilesOnly.ts"
} |
TypeScript/tests/cases/compiler/es5-asyncFunctionWhileStatements.ts_0_1491 | // @lib: es5,es2015.promise
// @noEmitHelpers: true
// @target: ES5
declare var x, y, z, a, b, c;
async function whileStatement0() {
while (x) { y; }
}
async function whileStatement1() {
while (await x) { y; }
}
async function whileStatement2() {
while (x) { await y; }
}
async function whileStatement3()... | {
"end_byte": 1491,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-asyncFunctionWhileStatements.ts"
} |
TypeScript/tests/cases/compiler/circularOptionalityRemoval.ts_0_185 | // @strictNullChecks: true
// Constructed repro
function fn1(x: number | undefined = x > 0 ? x : 0) { }
// Report from user
function fn2(x?: string = someCondition ? 'value1' : x) { } | {
"end_byte": 185,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/circularOptionalityRemoval.ts"
} |
TypeScript/tests/cases/compiler/destructuringWithNewExpression.ts_0_42 | class C {
x = 0;
}
var { x } = new C; | {
"end_byte": 42,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructuringWithNewExpression.ts"
} |
TypeScript/tests/cases/compiler/es6ExportDefaultFunctionDeclaration2.ts_0_70 | // @target: es6
// @declaration: true
export default function () { }
| {
"end_byte": 70,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ExportDefaultFunctionDeclaration2.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationPublicMethodSyntaxOfClass.ts_0_73 | // @allowJs: true
// @filename: a.js
class C {
public foo() {
}
} | {
"end_byte": 73,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationPublicMethodSyntaxOfClass.ts"
} |
TypeScript/tests/cases/compiler/genericCallInferenceConditionalType2.ts_0_761 | // @strict: true
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/59490
type ComponentProps<T> = T extends (props: infer P) => unknown ? P : never;
declare function wrapComponent<P>(
component: (props: P) => unknown,
): (props: P) => unknown;
const WrappedComponent = wrapComponent(
<T extends ... | {
"end_byte": 761,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericCallInferenceConditionalType2.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitStringEnumUsedInNonlocalSpread.ts_0_556 | // @declaration: true
// @filename: class.ts
export const enum TestEnum {
Test1 = '123123',
Test2 = '12312312312',
}
export interface ITest {
[TestEnum.Test1]: string;
[TestEnum.Test2]: string;
}
export class A {
getA(): ITest {
return {
[TestEnum.Test1]: '123',
[Te... | {
"end_byte": 556,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitStringEnumUsedInNonlocalSpread.ts"
} |
TypeScript/tests/cases/compiler/mixedTypeEnumComparison.ts_0_528 | // @strict: true
const enum E {
S1 = "foo",
S2 = "bar",
N1 = 1000,
N2 = 25,
}
declare var someNumber: number
if (someNumber > E.N2) {
someNumber = E.N2;
}
declare const unionOfEnum: E.N1 | E.N2;
if (someNumber > unionOfEnum) {
someNumber = E.N2;
}
declare var someString: string
if (someS... | {
"end_byte": 528,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mixedTypeEnumComparison.ts"
} |
TypeScript/tests/cases/compiler/staticMustPrecedePublic.ts_0_84 | class Outer {
static public intI: number;
static private stringF: string;
}
| {
"end_byte": 84,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/staticMustPrecedePublic.ts"
} |
TypeScript/tests/cases/compiler/importNonExportedMember12.ts_0_399 | // @esModuleInterop: true
// @moduleResolution: node
// @module: es2015
// @checkJs: true
// @allowJs: true
// @noEmit: true
// @Filename: /node_modules/foo/package.json
{ "name": "foo", "version": "1.2.3", "main": "src/index.js" }
// @Filename: /node_modules/foo/src/index.js
module.exports = 1;
// @filename: /a.js
... | {
"end_byte": 399,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importNonExportedMember12.ts"
} |
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.ts_0_478 | // @noImplicitReferences: true
// @traceResolution: true
// @allowJs: true
// @esModuleInterop: true
// @fullEmitPaths: true
// @Filename: /node_modules/foo/bar/foobar.js
module.exports = { a: 10 };
// @Filename: /a.ts
import foobar from "foo/bar/foobar.js";
// @Filename: /tsconfig.json
{
"compilerOptions": {
... | {
"end_byte": 478,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationTypeParameterSyntaxOfClassExpression.ts_0_79 | // @allowJs: true
// @noEmit: true
// @filename: a.js
const Bar = class<T> {};
| {
"end_byte": 79,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationTypeParameterSyntaxOfClassExpression.ts"
} |
TypeScript/tests/cases/compiler/requiredInitializedParameter2.ts_0_83 | interface I1 {
method();
}
class C1 implements I1 {
method(a = 0, b) { }
} | {
"end_byte": 83,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requiredInitializedParameter2.ts"
} |
TypeScript/tests/cases/compiler/blockScopedBindingCaptureThisInFunction.ts_0_164 | // https://github.com/Microsoft/TypeScript/issues/11038
() => function () {
for (let someKey in {}) {
this.helloWorld();
() => someKey;
}
}; | {
"end_byte": 164,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/blockScopedBindingCaptureThisInFunction.ts"
} |
TypeScript/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts_0_618 | // @lib: es5
// @sourcemap: true
interface Robot {
name: string;
skill: string;
}
declare var console: {
log(msg: string): void;
}
var hello = "hello";
var robotA: Robot = { name: "mower", skill: "mowing" };
function foo1({ name: nameA }: Robot) {
console.log(nameA);
}
function foo2({ name: nameB, skil... | {
"end_byte": 618,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts"
} |
TypeScript/tests/cases/compiler/undeclaredBase.ts_0_45 | module M { export class C extends M.I { } }
| {
"end_byte": 45,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/undeclaredBase.ts"
} |
TypeScript/tests/cases/compiler/noSelfOnVars.ts_0_61 | function foo() {
function bar() { }
var x = bar;
}
| {
"end_byte": 61,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noSelfOnVars.ts"
} |
TypeScript/tests/cases/compiler/classDeclarationBlockScoping1.ts_0_36 | class C {
}
{
class C {
}
} | {
"end_byte": 36,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classDeclarationBlockScoping1.ts"
} |
TypeScript/tests/cases/compiler/capturedLetConstInLoop6_ES6.ts_0_3377 | // @target: ES6
// ====let
for (let x of []) {
(function() { return x});
(() => x);
if (x == 1) {
break;
}
if (x == 2) {
continue;
}
}
for (let x in []) {
(function() { return x});
(() => x);
if (x == "1") {
break;
}
if (x == "2") {
continue;
... | {
"end_byte": 3377,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop6_ES6.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitForDefaultExportClassExtendingExpression01.ts_0_295 | // @declaration: true
interface Greeter {
getGreeting(): string;
}
interface GreeterConstructor {
new (): Greeter;
}
class A {
getGreeting() {
return 'hello';
}
}
const getGreeterBase = (): GreeterConstructor => A;
export default class extends getGreeterBase() {
}
| {
"end_byte": 295,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitForDefaultExportClassExtendingExpression01.ts"
} |
TypeScript/tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts_0_1009 | // @target: ES6
// destructuring in variable declarations
let foo = "bar";
let {[foo]: bar} = {bar: "bar"};
let {["bar"]: bar2} = {bar: "bar"};
let {[11]: bar2_1} = {11: "bar"};
let foo2 = () => "bar";
let {[foo2()]: bar3} = {bar: "bar"};
let [{[foo]: bar4}] = [{bar: "bar"}];
let [{[foo2()]: bar5}] = [{bar: "bar"}];... | {
"end_byte": 1009,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitHigherOrderRetainedGenerics.ts_0_3956 | // @declaration: true
// @emitDeclarationOnly: true
// @target: es6
export interface TypeLambda {
readonly In: unknown
readonly Out2: unknown
readonly Out1: unknown
readonly Target: unknown
}
export namespace Types {
export type Invariant<A> = (_: A) => A
export type Covariant<A> = (_: never) =>... | {
"end_byte": 3956,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitHigherOrderRetainedGenerics.ts"
} |
TypeScript/tests/cases/compiler/moduleAugmentationNoNewNames.ts_0_618 | // @module: commonjs
// @filename: map.ts
import { Observable } from "./observable"
(<any>Observable.prototype).map = function() { }
declare module "./observable" {
interface Observable<T> {
map<U>(proj: (e:T) => U): Observable<U>
}
class Bar {}
let y: number, z: string;
let {a: x, b: x1}... | {
"end_byte": 618,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationNoNewNames.ts"
} |
TypeScript/tests/cases/compiler/classMemberInitializerWithLamdaScoping.ts_0_996 | // @lib: es5
declare var console: {
log(msg?: any): void;
};
class Test {
constructor(private field: string) {
}
messageHandler = () => {
var field = this.field;
console.log(field); // Using field here shouldnt be error
};
static field: number;
static staticMessageHandler = (... | {
"end_byte": 996,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classMemberInitializerWithLamdaScoping.ts"
} |
TypeScript/tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts_0_130 | for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else
y = 5;
}
| {
"end_byte": 130,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts"
} |
TypeScript/tests/cases/compiler/internalAliasFunction.ts_0_187 | // @declaration: true
module a {
export function foo(x: number) {
return x;
}
}
module c {
import b = a.foo;
export var bVal = b(10);
export var bVal2 = b;
}
| {
"end_byte": 187,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasFunction.ts"
} |
TypeScript/tests/cases/compiler/argumentsReferenceInConstructor3_Js.ts_0_382 | // @declaration: true
// @allowJs: true
// @emitDeclarationOnly: true
// @filename: /a.js
class A {
get arguments() {
return { bar: {} };
}
}
class B extends A {
/**
* Constructor
*
* @param {object} [foo={}]
*/
constructor(foo = {}) {
super();
/**
* @type object
*/
this.foo = foo;
/**
... | {
"end_byte": 382,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/argumentsReferenceInConstructor3_Js.ts"
} |
TypeScript/tests/cases/compiler/mapConstructor.ts_0_314 | // @strict: true
// @target: es2015
new Map();
const potentiallyUndefinedIterable = [['1', 1], ['2', 2]] as Iterable<[string, number]> | undefined;
new Map(potentiallyUndefinedIterable);
const potentiallyNullIterable = [['1', 1], ['2', 2]] as Iterable<[string, number]> | null;
new Map(potentiallyNullIterable); | {
"end_byte": 314,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mapConstructor.ts"
} |
TypeScript/tests/cases/compiler/reverseMappedTypePrimitiveConstraintProperty.ts_0_294 | // @strict: true
// @noEmit: true
declare function test<
T extends { prop: string; nested: { nestedProp: string } },
>(obj: { [K in keyof T]: T[K] }): T;
const result = test({
prop: "foo", // this one should not widen to string
nested: {
nestedProp: "bar",
},
extra: "baz",
});
| {
"end_byte": 294,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reverseMappedTypePrimitiveConstraintProperty.ts"
} |
TypeScript/tests/cases/compiler/keepImportsInDts4.ts_0_151 | // @module: amd
// @declaration: true
// @outFile: outputfile.js
// @filename: folder/test.ts
export {};
// @filename: main.ts
import "./folder/test"
| {
"end_byte": 151,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/keepImportsInDts4.ts"
} |
TypeScript/tests/cases/compiler/contextualTypingOfLambdaWithMultipleSignatures2.ts_0_90 | var f: {
(x: string): string;
(x: number): string
};
f = (a) => { return a.asdf } | {
"end_byte": 90,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTypingOfLambdaWithMultipleSignatures2.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitRetainedAnnotationRetainsImportInOutput.ts_0_330 | // @strict: true
// @declaration: true
// @filename: node_modules/whatever/index.d.ts
export type Whatever<T> = {x: T};
export declare function something<T>(cb: () => Whatever<T>): Whatever<T>;
// @filename: index.ts
import * as E from 'whatever';
export const run = <E>(i: () => E.Whatever<E>): E.Whatever<E> => E.som... | {
"end_byte": 330,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitRetainedAnnotationRetainsImportInOutput.ts"
} |
TypeScript/tests/cases/compiler/controlFlowPrivateClassField.ts_0_432 | // @strict: true
// @target: esnext
// @useDefineForClassFields: false
class Example {
#test;
constructor(test: number) {
this.#test = test;
}
get test() {
return this.#test
}
}
class Example2 {
#test;
constructor(test: number | undefined) {
this.#test = test;
... | {
"end_byte": 432,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/controlFlowPrivateClassField.ts"
} |
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution8_node.ts_0_424 | // @moduleResolution: node
// @module: commonjs
// @traceResolution: true
// @filename: c:/root/tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@speedy/*/testing": [
"*/dist/index.ts"
]
}
}
}
// @filename: c:/root/index.ts
import ... | {
"end_byte": 424,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution8_node.ts"
} |
TypeScript/tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts_0_655 | class a {
}
class b1 extends a {
constructor(_super: number) { // should be error
super();
}
}
class b2 extends a {
constructor(private _super: number) { // should be error
super();
}
}
class b3 extends a {
constructor(_super: number); // no code gen - no error
constructor(_su... | {
"end_byte": 655,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts"
} |
TypeScript/tests/cases/compiler/functionOverloads24.ts_0_142 | function foo(bar:number):(b:string)=>void;
function foo(bar:string):(a:number)=>void;
function foo(bar:any):(a)=>void { return function(){} }
| {
"end_byte": 142,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloads24.ts"
} |
TypeScript/tests/cases/compiler/functionOverloadsOutOfOrder.ts_0_294 | class d {
private foo(n: number): string;
private foo(ns: any) {
return ns.toString();
}
private foo(s: string): string;
}
class e {
private foo(ns: any) {
return ns.toString();
}
private foo(s: string): string;
private foo(n: number): string;
} | {
"end_byte": 294,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionOverloadsOutOfOrder.ts"
} |
TypeScript/tests/cases/compiler/definiteAssignmentOfDestructuredVariable.ts_0_300 | // @strictNullChecks: true
// https://github.com/Microsoft/TypeScript/issues/20994
interface Options {
a?: number | object;
b: () => void;
}
class C<T extends Options> {
foo!: { [P in keyof T]: T[P] }
method() {
let { a, b } = this.foo;
!(a && b);
a;
}
} | {
"end_byte": 300,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/definiteAssignmentOfDestructuredVariable.ts"
} |
TypeScript/tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration.ts_0_426 | //@module: amd
// @Filename: ambientExternalModuleWithInternalImportDeclaration_0.ts
declare module 'M' {
module C {
export var f: number;
}
class C {
foo(): void;
}
import X = C;
export = X;
}
// @Filename: ambientExternalModuleWithInternalImportDeclaration_1.ts
///<reference ... | {
"end_byte": 426,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration.ts"
} |
TypeScript/tests/cases/compiler/coAndContraVariantInferences6.ts_0_956 | // @strict: true
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/57911
interface ExactProps {
value: "A" | "B";
}
interface FunctionComponent<P = {}> {
(props: P): ReactElement<any> | null;
}
declare class Component<P> {
constructor(props: P);
}
interface ComponentClass<P = {}> {
new (props... | {
"end_byte": 956,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/coAndContraVariantInferences6.ts"
} |
TypeScript/tests/cases/compiler/importNonExportedMember8.ts_0_195 | // @esModuleInterop: false
// @module: commonjs
// @checkJs: true
// @allowJs: true
// @noEmit: true
// @Filename: a.ts
class Foo {}
export = Foo;
// @Filename: b.js
import { Foo } from './a';
| {
"end_byte": 195,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importNonExportedMember8.ts"
} |
TypeScript/tests/cases/compiler/es6ExportClauseWithAssignmentInEs5.ts_0_315 | // @target: es5
// @module: commonjs
// @filename: server.ts
var foo = 2;
foo = 3;
var baz = 3;
baz = 4;
var buzz = 10;
buzz += 3;
var bizz = 8;
bizz++; // compiles to exports.bizz = (bizz++, bizz)
bizz--; // similarly
++bizz; // compiles to exports.bizz = ++bizz
export { foo, baz, baz as quux, buzz, bizz };
| {
"end_byte": 315,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ExportClauseWithAssignmentInEs5.ts"
} |
TypeScript/tests/cases/compiler/objectLiteral2.ts_0_26 | var v30 = {a:1, b:2}, v31; | {
"end_byte": 26,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectLiteral2.ts"
} |
TypeScript/tests/cases/compiler/dynamicNames.ts_0_2902 | // @target: esnext
// @lib: esnext
// @module: commonjs
// @declaration: true
// @filename: module.ts
export const c0 = "a";
export const c1 = 1;
export const s0 = Symbol();
export interface T0 {
[c0]: number;
[c1]: string;
[s0]: boolean;
}
export declare class T1 implements T2 {
[c0]: number;
[c1]:... | {
"end_byte": 2902,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/dynamicNames.ts"
} |
TypeScript/tests/cases/compiler/narrowByClauseExpressionInSwitchTrue9.ts_0_307 | // @strict: true
// @noEmit: true
interface IProps {
one: boolean;
}
class Foo {
mine: string = "";
myMethod(x: IProps) {
const { one } = x;
switch (true) {
case one:
break;
default:
let x = this.mine;
}
}
}
| {
"end_byte": 307,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/narrowByClauseExpressionInSwitchTrue9.ts"
} |
TypeScript/tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts_0_232 | // @target: ES6
// Error as declaration of var would cause a write to the const value
var x = 0;
{
const x = 0;
var x = 0;
}
var y = 0;
{
const y = 0;
{
var y = 0;
}
}
{
const z = 0;
var z = 0
} | {
"end_byte": 232,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts"
} |
TypeScript/tests/cases/compiler/collisionCodeGenModuleWithEnumMemberConflict.ts_0_61 | module m1 {
enum e {
m1,
m2 = m1
}
} | {
"end_byte": 61,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionCodeGenModuleWithEnumMemberConflict.ts"
} |
TypeScript/tests/cases/compiler/lateBoundConstraintTypeChecksCorrectly.ts_0_465 | // @keyofStringsOnly: true
declare const fooProp: unique symbol;
declare const barProp: unique symbol;
type BothProps = typeof fooProp | typeof barProp;
export interface Foo<T> {
[fooProp]: T;
[barProp]: string;
}
function f<T extends Foo<number>>(x: T) {
const abc = x[fooProp]; // expected: 'T[typeof fooPr... | {
"end_byte": 465,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/lateBoundConstraintTypeChecksCorrectly.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitDefaultExport5.ts_0_60 | // @declaration: true
// @target: es6
export default 1 + 2;
| {
"end_byte": 60,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitDefaultExport5.ts"
} |
TypeScript/tests/cases/compiler/requireOfJsonFileNonRelative.ts_0_434 | // @module: commonjs
// @outdir: out/
// @allowJs: true
// @fullEmitPaths: true
// @resolveJsonModule: true
// @Filename: /src/projects/file1.ts
import b1 = require('b.json');
let x = b1.a;
import b2 = require('c.json');
if (x) {
let b = b2.b;
x = (b1.b === b);
}
// @Filename: /src/projects/node_modules/b.jso... | {
"end_byte": 434,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireOfJsonFileNonRelative.ts"
} |
TypeScript/tests/cases/compiler/reachabilityChecks8.ts_0_192 | // @allowUnreachableCode: false
try {
for (
(function () { throw "1"; })();
(function () { throw "2"; })();
(function () { throw "3"; })()
) {}
} catch (e) {}
| {
"end_byte": 192,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reachabilityChecks8.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts_0_443 | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @noFallthroughCasesInSwitch: true
// @allowUnreachableCode: false
// @allowUnusedLabels: false
// @filename: a.js
function foo(a, b) {
switch (a) {
case 10:
if (b) {
return b;
}
case 20:
retu... | {
"end_byte": 443,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts"
} |
TypeScript/tests/cases/compiler/recursiveGenericTypeHierarchy.ts_0_150 | // used to ICE
interface A<T extends A<T, S>, S extends A<T, S>> { }
interface B<T extends B<T, S>, S extends B<T, S>> extends A<B<T, S>, B<T, S>> { } | {
"end_byte": 150,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveGenericTypeHierarchy.ts"
} |
TypeScript/tests/cases/compiler/es2017basicAsync.ts_0_838 | // @target: es2017
// @lib: es2017
// @noEmitHelpers: true
async (): Promise<void> => {
await 0;
}
async function asyncFunc() {
await 0;
}
const asyncArrowFunc = async (): Promise<void> => {
await 0;
}
async function asyncIIFE() {
await 0;
await (async function(): Promise<void> {
await ... | {
"end_byte": 838,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es2017basicAsync.ts"
} |
TypeScript/tests/cases/compiler/redefineArray.ts_0_50 | Array = function (n:number, s:string) {return n;}; | {
"end_byte": 50,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/redefineArray.ts"
} |
TypeScript/tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts_0_308 | //@noUnusedLocals:true
//@noUnusedParameters:true
function greeter(person: string, person2: string) {
var unused = 20;
var maker = function(child: string): void {
var unused2 = 22;
}
var maker2 = function(child2: string): void {
var unused3 = 23;
}
maker2(person2);
} | {
"end_byte": 308,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts"
} |
TypeScript/tests/cases/compiler/isolatedModulesExternalModuleForced.ts_0_99 | // @isolatedModules: true
// @target: es6
// @moduleDetection: force
// @filename: file1.ts
var x; | {
"end_byte": 99,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesExternalModuleForced.ts"
} |
TypeScript/tests/cases/compiler/shorthandOfExportedEntity02_targetES5_CommonJS.ts_0_138 | // @target: ES5
// @module: commonjs
// @declaration: true
export const test = "test";
export function foo () {
const x = { test };
}
| {
"end_byte": 138,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/shorthandOfExportedEntity02_targetES5_CommonJS.ts"
} |
TypeScript/tests/cases/compiler/uniqueSymbolPropertyDeclarationEmit.ts_0_410 | // @noTypesAndSymbols: true
// @esModuleInterop: true
// @declaration: true
// @Filename: test.ts
import Op from './op';
import { Po } from './po';
export default function foo() {
return {
[Op.or]: [],
[Po.ro]: {}
};
}
// @Filename: op.ts
declare const Op: {
readonly or: unique symbol;
};
export defau... | {
"end_byte": 410,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/uniqueSymbolPropertyDeclarationEmit.ts"
} |
TypeScript/tests/cases/compiler/es5-asyncFunctionSwitchStatements.ts_0_1250 | // @lib: es5,es2015.promise
// @noEmitHelpers: true
// @target: ES5
declare var x, y, z, a, b, c;
async function switchStatement0() {
switch (x) {
case y: a; break;
default: b; break;
}
}
async function switchStatement1() {
switch (await x) {
case y: a; break;
default: b; b... | {
"end_byte": 1250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-asyncFunctionSwitchStatements.ts"
} |
TypeScript/tests/cases/compiler/thisTypeAsConstraint.ts_0_46 | class C {
public m<T extends this>() {
}
} | {
"end_byte": 46,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisTypeAsConstraint.ts"
} |
TypeScript/tests/cases/compiler/promiseVoidErrorCallback.ts_0_395 | //@target: ES6
interface T1 {
__t1: string;
}
interface T2 {
__t2: string;
}
interface T3 {
__t3: string;
}
function f1(): Promise<T1> {
return Promise.resolve({ __t1: "foo_t1" });
}
function f2(x: T1): T2 {
return { __t2: x.__t1 + ":foo_21" };
}
var x3 = f1()
.then(f2, (e: Error) => {
... | {
"end_byte": 395,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/promiseVoidErrorCallback.ts"
} |
TypeScript/tests/cases/compiler/anyAndUnknownHaveFalsyComponents.ts_0_435 | // @strictNullChecks: true
declare let x1: any;
const y1 = x1 && 3;
// #39113
declare let isTreeHeader1: any;
function foo1() {
return {
display: "block",
...(isTreeHeader1 && {
display: "flex",
})
};
}
declare let x2: unknown;
const y2 = x2 && 3;
// #39113
declare let isTreeHeader2: unknown;
... | {
"end_byte": 435,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/anyAndUnknownHaveFalsyComponents.ts"
} |
TypeScript/tests/cases/compiler/libMembers.ts_0_229 | var s="hello";
s.substring(0);
s.substring(3,4);
s.subby(12); // error unresolved
String.fromCharCode(12);
module M {
export class C {
}
var a=new C[];
a.length;
a.push(new C());
(new C()).prototype;
}
| {
"end_byte": 229,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/libMembers.ts"
} |
TypeScript/tests/cases/compiler/namespaceDisambiguationInUnion.ts_0_265 | namespace Foo {
export type Yep = { type: "foo.yep" };
}
namespace Bar {
export type Yep = { type: "bar.yep" };
}
const x = { type: "wat.nup" };
const val1: Foo.Yep | Bar.Yep = x;
const y = [{ type: "a" }, { type: "b" }];
const val2: [Foo.Yep, Bar.Yep] = y;
| {
"end_byte": 265,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/namespaceDisambiguationInUnion.ts"
} |
TypeScript/tests/cases/compiler/typeAnnotationBestCommonTypeInArrayLiteral.ts_0_408 | interface IMenuItem {
id: string;
type: string;
link?: string;
classes?: string;
text?: string;
icon?: string;
}
var menuData: IMenuItem[] = [
{
"id": "ourLogo",
"type": "image",
"link": "",
"icon": "modules/menu/logo.svg"
}, {
"id": "productName",... | {
"end_byte": 408,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeAnnotationBestCommonTypeInArrayLiteral.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.