_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/compiler/FunctionDeclaration4.ts_0_34 | function foo();
function bar() { } | {
"end_byte": 34,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/FunctionDeclaration4.ts"
} |
TypeScript/tests/cases/compiler/prefixIncrementAsOperandOfPlusExpression.ts_0_35 | var x = 1;
var y = 1;
+ ++x;
+ ++y; | {
"end_byte": 35,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/prefixIncrementAsOperandOfPlusExpression.ts"
} |
TypeScript/tests/cases/compiler/errorSpanForUnclosedJsxTag.tsx_0_138 | // @jsx: react
declare const React: any
let Foo = {
Bar() {}
}
let Baz = () => {}
let x = < Foo.Bar >Hello
let y = < Baz >Hello | {
"end_byte": 138,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/errorSpanForUnclosedJsxTag.tsx"
} |
TypeScript/tests/cases/compiler/defaultDeclarationEmitShadowedNamedCorrectly.ts_0_488 | // @declaration: true
// @filename: this.ts
import * as me from "./this";
export interface Things<P, T> {
p: P;
t: T;
}
export function make<P, CTor>(x: { new (): CTor & {props: P} }): Things<P, CTor> {
return null as any;
}
export interface Props {
}
export default class MyComponent {
props: Props;
}... | {
"end_byte": 488,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/defaultDeclarationEmitShadowedNamedCorrectly.ts"
} |
TypeScript/tests/cases/compiler/styleOptions.ts_0_78 | ///<style eqeqeq="on" strict="on" />
var x = 1;
var y = 1;
var t = x == y;
| {
"end_byte": 78,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/styleOptions.ts"
} |
TypeScript/tests/cases/compiler/requireOfJsonFileWithTraillingComma.ts_0_321 | // @module: commonjs
// @outdir: out/
// @allowJs: true
// @fullEmitPaths: true
// @resolveJsonModule: true
// @Filename: file1.ts
import b1 = require('./b.json');
let x = b1.a;
import b2 = require('./b.json');
if (x) {
let b = b2.b;
x = (b1.b === b);
}
// @Filename: b.json
{
"a": true,
"b": "hello",
... | {
"end_byte": 321,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireOfJsonFileWithTraillingComma.ts"
} |
TypeScript/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts_0_2796 | // @lib: es5
// @sourcemap: true
declare var console: {
log(msg: any): void;
}
interface Robot {
name: string;
skill: string;
}
interface MultiRobot {
name: string;
skills: {
primary?: string;
secondary?: string;
};
}
let robot: Robot = { name: "mower", skill: "mowing" };
let m... | {
"end_byte": 2796,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts"
} |
TypeScript/tests/cases/compiler/jsxFactoryNotIdentifierOrQualifiedName2.ts_0_1038 | //@jsx: react
//@target: es6
//@module: commonjs
//@jsxFactory: id1 id2
// @filename: Element.ts
declare namespace JSX {
interface Element {
name: string;
isIntrinsic: boolean;
isCustomElement: boolean;
toString(renderId?: number): string;
bindDOM(renderId?: number): number;... | {
"end_byte": 1038,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxFactoryNotIdentifierOrQualifiedName2.ts"
} |
TypeScript/tests/cases/compiler/varianceMeasurement.ts_0_1598 | // @strict: true
// The type below should be invariant in T but is measured as covariant because
// we don't analyze recursive references.
interface Foo1<T> {
x: T;
y: Foo1<(arg: T) => void>;
}
declare const f10: Foo1<string>;
const f11: Foo1<'a'> = f10;
const f12: Foo1<unknown> = f10;
// The type below is inva... | {
"end_byte": 1598,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/varianceMeasurement.ts"
} |
TypeScript/tests/cases/compiler/optionalParamReferencingOtherParams1.ts_0_67 | function strange(x: number, y = x * 1, z = x + y) {
return z;
} | {
"end_byte": 67,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/optionalParamReferencingOtherParams1.ts"
} |
TypeScript/tests/cases/compiler/es6ModuleClassDeclaration.ts_0_1967 | // @target: ES6
export class c {
constructor() {
}
private x = 10;
public y = 30;
static k = 20;
private static l = 30;
private method1() {
}
public method2() {
}
static method3() {
}
private static method4() {
}
}
class c2 {
constructor() {
}
private ... | {
"end_byte": 1967,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ModuleClassDeclaration.ts"
} |
TypeScript/tests/cases/compiler/collisionThisExpressionAndParameter.ts_0_2533 | // @lib: es5
class Foo {
x() {
var _this = 10; // Local var. No this capture in x(), so no conflict.
function inner(_this: number) { // Error
return x => this; // New scope. So should inject new _this capture into function inner
}
}
y() {
var lamda = (_this: n... | {
"end_byte": 2533,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionThisExpressionAndParameter.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitConstantNoWidening.ts_0_168 | // @declaration: true
export const FOO = 'FOO';
export class Bar {
readonly type = FOO; // Should be widening literal "FOO" - so either `typeof "FOO"` or = "FOO"
} | {
"end_byte": 168,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitConstantNoWidening.ts"
} |
TypeScript/tests/cases/compiler/module_augmentExistingVariable.ts_0_72 | // @lib: es5
var console: any;
module console {
export var x = 2;
} | {
"end_byte": 72,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/module_augmentExistingVariable.ts"
} |
TypeScript/tests/cases/compiler/recursiveTypeAliasWithSpreadConditionalReturnNotCircular.ts_0_901 | export {}
export interface Option<T> {
zip1<O extends Array<Option<any>>>(...others: O): Option<[T, ...UnzipOptionArray1<O>]>;
zip2<O extends Array<Option<any>>>(...others: O): Option<[T, ...UnzipOptionArray2<O>]>;
zip3<O extends Array<Option<any>>>(...others: O): Option<[T, ...UnzipOptionArray3<O>]>;
}
type Unzi... | {
"end_byte": 901,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveTypeAliasWithSpreadConditionalReturnNotCircular.ts"
} |
TypeScript/tests/cases/compiler/jsdocTypedef_propertyWithNoType.ts_0_157 | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: /a.js
/**
* @typedef Foo
* @property foo
*/
/** @type {Foo} */
const x = { foo: 0 };
| {
"end_byte": 157,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocTypedef_propertyWithNoType.ts"
} |
TypeScript/tests/cases/compiler/contextualTypingOfLambdaReturnExpression.ts_0_367 | function callb(lam: (l: number) => void);
function callb(lam: (n: string) => void);
function callb(a) { }
callb((a) => a.length); // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type
callb((a) => { a.length; }); // Error, we picked the first overload... | {
"end_byte": 367,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTypingOfLambdaReturnExpression.ts"
} |
TypeScript/tests/cases/compiler/exportEqualErrorType.ts_0_578 | //@module: amd
// @Filename: exportEqualErrorType_0.ts
module server {
export interface connectModule {
(res, req, next): void;
}
export interface connectExport {
use: (mod: connectModule) => connectExport;
}
}
var server: {
(): server.connectExport;
foo: Date;
};
export = server... | {
"end_byte": 578,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportEqualErrorType.ts"
} |
TypeScript/tests/cases/compiler/genericPrototypeProperty3.ts_0_279 | class BaseEvent {
target: {};
}
class MyEvent<T> extends BaseEvent { // T is instantiated to any in the prototype, which is assignable to {}
target: T;
}
class BaseEventWrapper {
t: BaseEvent;
}
class MyEventWrapper extends BaseEventWrapper {
t: MyEvent<any>;
} | {
"end_byte": 279,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericPrototypeProperty3.ts"
} |
TypeScript/tests/cases/compiler/localClassesInLoop.ts_0_161 | declare function use(a: any);
"use strict"
var data = [];
for (let x = 0; x < 2; ++x) {
class C { }
data.push(() => C);
}
use(data[0]() === data[1]()); | {
"end_byte": 161,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/localClassesInLoop.ts"
} |
TypeScript/tests/cases/compiler/jsdocTypeCast.ts_0_348 | // @allowJs: true
// @checkJs: true
// @outDir: ./out
// @filename: jsdocTypeCast.js
/**
* @param {string} x
*/
function f(x) {
/** @type {'a' | 'b'} */
let a = (x); // Error
a;
/** @type {'a' | 'b'} */
let b = (((x))); // Error
b;
/** @type {'a' | 'b'} */
let c = /** @type {'a' | ... | {
"end_byte": 348,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocTypeCast.ts"
} |
TypeScript/tests/cases/compiler/genericInference1.ts_0_35 | ['a', 'b', 'c'].map(x => x.length); | {
"end_byte": 35,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericInference1.ts"
} |
TypeScript/tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts_0_175 | //@module: amd
class D { }
export = D;
declare module "ext" {
export class C { }
}
// Cannot resolve this ext module reference
import ext = require("ext");
var x = ext; | {
"end_byte": 175,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts"
} |
TypeScript/tests/cases/compiler/objectGroupBy.ts_0_354 | // @target: esnext
const basic = Object.groupBy([0, 2, 8], x => x < 5 ? 'small' : 'large');
const chars = Object.groupBy('a string', c => c);
type Employee = { name: string, role: 'ic' | 'manager' }
const employees: Set<Employee> = new Set();
const byRole = Object.groupBy(employees, x => x.role);
const byNonKey = O... | {
"end_byte": 354,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectGroupBy.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitBindingPatternsFunctionExpr.ts_0_725 | // @declaration: true
// @target: esnext
// @skipLibCheck: false
type Named = { name: string }
// Tempting to remove alias if unused
let notReferenced = ({ name: alias }: Named) => { }
// Resons we can't remove aliases that are not used in the function signature:
// 1.Causes duplicate identifier if we remove alias... | {
"end_byte": 725,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitBindingPatternsFunctionExpr.ts"
} |
TypeScript/tests/cases/compiler/genericIndexTypeHasSensibleErrorMessage.ts_0_48 | type Wat<T extends string> = { [x: T]: string }; | {
"end_byte": 48,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericIndexTypeHasSensibleErrorMessage.ts"
} |
TypeScript/tests/cases/compiler/reverseMappedTypeContextualTypesPerElementOfTupleConstraint.ts_0_563 | // @strict: true
// @noEmit: true
type Tuple<T> = readonly [T, ...T[]];
declare function bindAll<
TTarget extends EventTarget,
TTypes extends Tuple<keyof TTarget & `on${any}`>
>(
target: TTarget,
bindings: {
[K in keyof TTypes]: {
type: TTypes[K];
listener: (
ev: Parameters<Extract<TTa... | {
"end_byte": 563,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reverseMappedTypeContextualTypesPerElementOfTupleConstraint.ts"
} |
TypeScript/tests/cases/compiler/inheritanceStaticMembersCompatible.ts_0_68 | class a {
static x: a;
}
class b extends a {
static x: b;
} | {
"end_byte": 68,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritanceStaticMembersCompatible.ts"
} |
TypeScript/tests/cases/compiler/protoAssignment.ts_1_180 | interface Number extends Comparable<number> {
compareTo(other: number);
}
Number.prototype.compareTo = function (other: number) {
return this.valueOf() == other;
}
| {
"end_byte": 180,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/protoAssignment.ts"
} |
TypeScript/tests/cases/compiler/invokingNonGenericMethodWithTypeArguments2.ts_0_91 | class Foo {
private foo: any;
constructor() {
this.foo<string>();
}
}
| {
"end_byte": 91,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/invokingNonGenericMethodWithTypeArguments2.ts"
} |
TypeScript/tests/cases/compiler/noConstraintInReturnType1.ts_0_110 | // @declaration: true
class List<T extends {}> {
static empty<T extends {}>(): List<T> { return null; }
}
| {
"end_byte": 110,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noConstraintInReturnType1.ts"
} |
TypeScript/tests/cases/compiler/strictOptionalProperties2.ts_0_263 | // @strict: true
// @exactOptionalPropertyTypes: true
// @declaration: true
// Repro from #44567
type T1 = { 0?: string | undefined } extends { 0?: string } ? true : false; // false
type T2 = [(string | undefined)?] extends [string?] ? true : false; // false
| {
"end_byte": 263,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/strictOptionalProperties2.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitSymlinkPaths.ts_0_970 | // @declaration: true
// @outDir: /packages/search-prefix/lib
// @rootDir: /packages/search-prefix/src
// @target: es5
// @filename: /packages/search/package.json
{
"name": "search",
"version": "0.0.1",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false
}
// @filename: /packages... | {
"end_byte": 970,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitSymlinkPaths.ts"
} |
TypeScript/tests/cases/compiler/regularExpressionGroupNameSuggestions.ts_0_33 | const regex = /(?<foo>)\k<Foo>/;
| {
"end_byte": 33,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/regularExpressionGroupNameSuggestions.ts"
} |
TypeScript/tests/cases/compiler/shorthand-property-es6-es6.ts_0_146 | // @target: ES6
// @module: ES6
// @declaration: true
// @filename: test.ts
import {foo} from './foo';
const baz = 42;
const bar = { foo, baz };
| {
"end_byte": 146,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/shorthand-property-es6-es6.ts"
} |
TypeScript/tests/cases/compiler/augmentedTypesModules3b.ts_0_412 | class m3b { foo() { } }
module m3b { var y = 2; }
class m3c { foo() { } }
module m3c { export var y = 2; }
declare class m3d { foo(): void }
module m3d { export var y = 2; }
module m3e { export var y = 2; }
declare class m3e { foo(): void }
declare class m3f { foo(): void }
module m3f { export interface I { foo... | {
"end_byte": 412,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/augmentedTypesModules3b.ts"
} |
TypeScript/tests/cases/compiler/importHelpersWithLocalCollisions.ts_0_776 | // @importHelpers: true
// @target: es6
// @module: commonjs, system, amd, es2015
// @moduleResolution: classic
// @experimentalDecorators: true
// @filename: a.ts
// @noTypesAndSymbols: true
declare var dec: any, __decorate: any;
@dec export class A {
}
const o = { a: 1 };
const y = { ...o };
// @filename: tslib.d.... | {
"end_byte": 776,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersWithLocalCollisions.ts"
} |
TypeScript/tests/cases/compiler/allowSyntheticDefaultImports2.ts_0_162 | // @module: system
// @Filename: a.ts
import Namespace from "./b";
export var x = new Namespace.Foo();
// @Filename: b.d.ts
export class Foo {
member: string;
} | {
"end_byte": 162,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/allowSyntheticDefaultImports2.ts"
} |
TypeScript/tests/cases/compiler/moduleImport.ts_3_206 | dule A.B.C {
import XYZ = X.Y.Z;
export function ping(x: number) {
if (x>0) XYZ.pong (x-1);
}
}
module X {
import ABC = A.B.C;
export function pong(x: number) {
if (x > 0) ABC.ping(x-1);
}
} | {
"end_byte": 206,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleImport.ts"
} |
TypeScript/tests/cases/compiler/constructorArgsErrors5.ts_0_57 | class foo {
constructor (export a: number) {
}
}
| {
"end_byte": 57,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constructorArgsErrors5.ts"
} |
TypeScript/tests/cases/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.ts_0_204 | // @allowJs: true
// @noImplicitReferences: true
// @maxNodeModuleJsDepth: 0
// @Filename: /node_modules/foo/index.js
exports.x = 0;
// @Filename: /src/index.ts
import { y } from "../node_modules/foo";
| {
"end_byte": 204,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.ts"
} |
TypeScript/tests/cases/compiler/contextualTyping16.ts_0_45 | var foo: {id:number;} = {id:4}; foo = {id:5}; | {
"end_byte": 45,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTyping16.ts"
} |
TypeScript/tests/cases/compiler/genericConstructorFunction1.ts_0_374 | function f1<T>(args: T) {
var v1: { [index: string]: new (arg: T) => Date };
var v2 = v1['test'];
v2(args);
return new v2(args); // used to give error
}
interface I1<T> { new (arg: T): Date };
function f2<T>(args: T) {
var v1: { [index: string]: I1<T> };
var v2 = v1['test'];
var y = v2(ar... | {
"end_byte": 374,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericConstructorFunction1.ts"
} |
TypeScript/tests/cases/compiler/genericWithNoConstraintComparableWithCurlyCurly.ts_0_437 | // @strict: true
function foo<T>() {
let x = {};
x as T;
}
function bar<T extends unknown>() {
let x = {};
x as T;
}
function baz<T extends {}>() {
let x = {};
x as T;
}
function bat<T extends object>() {
let x = {};
x as T;
}
function no<T extends null | undefined>() {
let x = {... | {
"end_byte": 437,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericWithNoConstraintComparableWithCurlyCurly.ts"
} |
TypeScript/tests/cases/compiler/importHelpersCommonJSJavaScript.ts_0_1066 | // @checkJs: true
// @outDir: ./out
// @module: commonjs
// @importHelpers: true
// @verbatimModuleSyntax: true,false
// @Filename: /node_modules/tslib/package.json
{
"name": "tslib",
"main": "tslib.js",
"module": "tslib.es6.js",
"jsnext:main": "tslib.es6.js",
"typings": "tslib.d.ts",
"exports": {
".... | {
"end_byte": 1066,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersCommonJSJavaScript.ts"
} |
TypeScript/tests/cases/compiler/decoratorMetadataWithConstructorType.ts_0_354 | // @noemithelpers: true
// @experimentaldecorators: true
// @emitdecoratormetadata: true
// @target: es5
// @module: commonjs
declare var console: {
log(msg: string): void;
};
class A {
constructor() { console.log('new A'); }
}
function decorator(target: Object, propertyKey: string) {
}
export class B {
... | {
"end_byte": 354,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/decoratorMetadataWithConstructorType.ts"
} |
TypeScript/tests/cases/compiler/methodSignatureDeclarationEmit1.ts_0_128 | // @declaration: true
class C {
public foo(n: number): void;
public foo(s: string): void;
public foo(a: any): void {
}
} | {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/methodSignatureDeclarationEmit1.ts"
} |
TypeScript/tests/cases/compiler/jsExportMemberMergedWithModuleAugmentation3.ts_0_182 | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: /x.js
module.exports.x = 1;
module.exports = require("./y.js");
// @Filename: /y.d.ts
export declare type x = 1;
| {
"end_byte": 182,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsExportMemberMergedWithModuleAugmentation3.ts"
} |
TypeScript/tests/cases/compiler/functionSubtypingOfVarArgs.ts_0_320 | class EventBase {
private _listeners = [];
add(listener: (...args: any[]) => void): void {
this._listeners.push(listener);
}
}
class StringEvent extends EventBase { // should work
add(listener: (items: string) => void ) { // valid, items is subtype of args
super.add(listener);
}
}
| {
"end_byte": 320,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionSubtypingOfVarArgs.ts"
} |
TypeScript/tests/cases/compiler/jsxNamespacedNameNotComparedToNonMatchingIndexSignature.tsx_0_252 | // @jsx: react-jsx
// @target: esnext
/// <reference path="/.lib/react16.d.ts" />
declare module "react" {
interface Attributes {
[key: `do-${string}`]: Function;
"ns:thing"?: string;
}
}
export const tag = <div ns:thing="a"/> | {
"end_byte": 252,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxNamespacedNameNotComparedToNonMatchingIndexSignature.tsx"
} |
TypeScript/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts_0_3605 | // @lib: es5
// @sourcemap: true
declare var console: {
log(msg: any): void;
}
interface Robot {
name: string;
skill: string;
}
interface MultiRobot {
name: string;
skills: {
primary: string;
secondary: string;
};
}
let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { n... | {
"end_byte": 3605,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts"
} |
TypeScript/tests/cases/compiler/capturedLetConstInLoop9.ts_0_2373 | for (let x = 0; x < 1; ++x) {
let x;
(function() { return x });
{
let x;
(function() { return x });
}
try { }
catch (e) {
let x;
(function() { return x });
}
switch (x) {
case 1:
let x;
(function() { return x });
... | {
"end_byte": 2373,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop9.ts"
} |
TypeScript/tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts_0_661 | // @lib: es6
// @noImplicitAny: true
let named = "foo";
let {[named]: prop} = {prop: "foo"};
void prop;
const numIndexed: {[idx: number]: string} = null as any;
const strIndexed: {[idx: string]: string} = null as any;
let numed = 6;
const symed = Symbol();
let symed2 = Symbol();
let {[named]: prop2} = numIndexed;
v... | {
"end_byte": 661,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts"
} |
TypeScript/tests/cases/compiler/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts_0_305 | // @strict: true
type PartialDeep<T> = {[K in keyof T]?: PartialDeep<T[K]>};
type Many<T> = T | readonly T[];
interface Collection<T> {
sortBy(...iteratees: Many<PartialDeep<T>>[]): Collection<T>;
}
const x: Collection<{x: number}> = (null as any as Collection<{x: number, y: number}>);
export {};
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts"
} |
TypeScript/tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts_3_88 | @removeComments: true
var x = 10;
/*!
multi line
comment
*/
var x = 10; | {
"end_byte": 88,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts"
} |
TypeScript/tests/cases/compiler/jsxGenericComponentWithSpreadingResultOfGenericFunction.tsx_0_468 | // @strict: true
// @noEmit: true
// @jsx: preserve
/// <reference path="/.lib/react16.d.ts" />
// repro #51577
declare function omit<T, K extends string>(names: readonly K[], obj: T): Omit<T, K>;
declare function omit<K extends string>(names: readonly K[]): <T>(obj: T) => Omit<T, K>;
declare const otherProps: { ba... | {
"end_byte": 468,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxGenericComponentWithSpreadingResultOfGenericFunction.tsx"
} |
TypeScript/tests/cases/compiler/isolatedDeclarationErrorsClasses.ts_0_1391 | // @declaration: true
// @isolatedDeclarations: true
// @declarationMap: false
// @strict: true
// @target: ESNext
export class Cls {
field = 1 + 1;
method() {}
methodOk(): void {}
methodParams(p): void {}
methodParams2(p = 1 + 1): void {}
get getOnly() { return 1 + 1 }
set setOnly(valu... | {
"end_byte": 1391,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedDeclarationErrorsClasses.ts"
} |
TypeScript/tests/cases/compiler/recursiveReverseMappedType.ts_0_316 | // @strict: true
// Repro from #38198
type Recur<T> = (
T extends (unknown[]) ? {} : { [K in keyof T]?: Recur<T[K]> }
) | ['marker', ...Recur<T>[]];
function join<T>(l: Recur<T>[]): Recur<T> {
return ['marker', ...l];
}
function a<T>(l: Recur<T>[]): void {
const x: Recur<T> | undefined = join(l);
}
| {
"end_byte": 316,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveReverseMappedType.ts"
} |
TypeScript/tests/cases/compiler/mixedExports.ts_0_244 | declare module M {
function foo();
export function foo();
function foo();
}
declare module M1 {
export interface Foo {}
interface Foo {}
}
module A {
interface X {x}
export module X {}
interface X {y}
} | {
"end_byte": 244,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mixedExports.ts"
} |
TypeScript/tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts_0_623 | // @declaration: true
export var noPrivates = class {
static getTags() { }
tags() { }
private static ps = -1
private p = 12
}
// altered repro from #15066 to add private property
export class FooItem {
foo(): void { }
name?: string;
private property = "capitalism"
}
export type Constructor... | {
"end_byte": 623,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts"
} |
TypeScript/tests/cases/compiler/collisionExportsRequireAndAmbientEnum.ts_0_1020 | //@module: amd
//@filename: collisionExportsRequireAndAmbientEnum_externalmodule.ts
export declare enum require {
_thisVal1,
_thisVal2,
}
export declare enum exports {
_thisVal1,
_thisVal2,
}
declare module m1 {
enum require {
_thisVal1,
_thisVal2,
}
enum exports {
_t... | {
"end_byte": 1020,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionExportsRequireAndAmbientEnum.ts"
} |
TypeScript/tests/cases/compiler/exportAssignedTypeAsTypeAnnotation.ts_0_370 | //@module: amd
// @Filename: exportAssignedTypeAsTypeAnnotation_0.ts
interface x {
(): Date;
foo: string;
}
export = x;
// @Filename: exportAssignedTypeAsTypeAnnotation_1.ts
///<reference path='exportAssignedTypeAsTypeAnnotation_0.ts'/>
import test = require('exportAssignedTypeAsTypeAnnotation_0');
var t2: t... | {
"end_byte": 370,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportAssignedTypeAsTypeAnnotation.ts"
} |
TypeScript/tests/cases/compiler/noImplicitAnyParametersInClass.ts_3_2442 | @noImplicitAny: true
class C {
// No implicit-'any' errors.
public pub_f1(): void { }
// Implicit-'any' errors for x.
public pub_f2(x): void { }
// No implicit-'any' errors.
public pub_f3(x: any): void { }
// Implicit-'any' errors for x, y, and z.
public pub_f4(x, y, z): void { }
... | {
"end_byte": 2442,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noImplicitAnyParametersInClass.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts_0_1070 | // @strict: true
// @strictNullChecks: true,false
// @declaration: true
// @noTypesAndSymbols: true
// @emitDeclarationOnly: true
export let vLet = null! as {} & { name: string }
export const vConst = null! as {} & { name: string }
export function fn(p = null! as {} & { name: string }) {}
export function fnWithRequir... | {
"end_byte": 1070,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts"
} |
TypeScript/tests/cases/compiler/parseJsxElementInUnaryExpressionNoCrash1.ts_0_60 | // @allowJs: true
// @outDir: ./out
// @filename: a.js
~< <
| {
"end_byte": 60,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseJsxElementInUnaryExpressionNoCrash1.ts"
} |
TypeScript/tests/cases/compiler/jsxElementTypeLiteralWithGeneric.tsx_0_543 | // @strict: true
// @jsx: react
/// <reference path="/.lib/react16.d.ts" />
import * as React from "react";
declare global {
namespace JSX {
type ElementType<P = any> =
| {
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K]
? K
: never;
}[keyof JSX.Intrinsi... | {
"end_byte": 543,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxElementTypeLiteralWithGeneric.tsx"
} |
TypeScript/tests/cases/compiler/switchCasesExpressionTypeMismatch.ts_0_497 | class Foo { }
switch (0) {
case Foo: break; // Error
case "sss": break; // Error
case 123: break; // Error
case true: break; // Error
}
declare var q: string
declare var r: number | "hello"
switch (r) {
case q: break
case 42: break
case true: break // Error
case "hello": brea... | {
"end_byte": 497,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/switchCasesExpressionTypeMismatch.ts"
} |
TypeScript/tests/cases/compiler/declFileTypeAnnotationTypeLiteral.ts_0_594 | // @target: ES5
// @declaration: true
class c {
}
class g<T> {
}
module m {
export class c {
}
}
// Object literal with everything
var x: {
// Call signatures
(a: number): c;
(a: string): g<string>;
// Construct signatures
new (a: number): c;
new (a: string): m.c;
// Indexers
... | {
"end_byte": 594,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declFileTypeAnnotationTypeLiteral.ts"
} |
TypeScript/tests/cases/compiler/extendGenericArray2.ts_0_119 | interface IFoo<T> {
x: T;
}
interface Array<T> extends IFoo<T> { }
var arr: string[] = [];
var y: number = arr.x; | {
"end_byte": 119,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/extendGenericArray2.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationTypeArgumentSyntaxOfCall.ts_0_149 | // @allowJs: true
// @noTypesAndSymbols: true
// @filename: a.jsx
Foo<number>();
Foo<number>(1);
Foo<number>``;
<Foo<number>></Foo>;
<Foo<number>/>;
| {
"end_byte": 149,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationTypeArgumentSyntaxOfCall.ts"
} |
TypeScript/tests/cases/compiler/controlFlowCommaExpressionAssertionMultiple.ts_0_302 | function Narrow<T>(value: any): asserts value is T {}
function func(foo: any, bar: any) {
Narrow<number>(foo), Narrow<string>(bar);
foo;
bar;
}
function func2(foo: any, bar: any, baz: any) {
Narrow<number>(foo), Narrow<string>(bar), Narrow<boolean>(baz);
foo;
bar;
baz;
}
| {
"end_byte": 302,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/controlFlowCommaExpressionAssertionMultiple.ts"
} |
TypeScript/tests/cases/compiler/superCallWithMissingBaseClass.ts_0_121 | class Foo extends Bar {
m1() {
return super.m1();
}
static m2() {
return super.m2();
}
} | {
"end_byte": 121,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superCallWithMissingBaseClass.ts"
} |
TypeScript/tests/cases/compiler/sideEffectImports2.ts_0_319 | // @noUncheckedSideEffectImports: true,false
// @module: nodenext
// @noImplicitAny: true,false
// @noEmit: true
// @filename: tsconfig.json
{
"include": ["index.ts"],
}
// @filename: index.ts
import "source-map-support/register";
// @filename: node_modules/source-map-support/register.js
module.exports = {};
| {
"end_byte": 319,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sideEffectImports2.ts"
} |
TypeScript/tests/cases/compiler/jsFileClassPropertyType3.ts_0_257 | // @allowJs: true
// @noEmit: true
// @filename: foo.js
class C {
constructor() {
if (cond) {
this.p = null;
}
else {
this.p = 0;
}
}
}
// @filename: bar.ts
(new C()).p = "string"; // Error
| {
"end_byte": 257,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileClassPropertyType3.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitTypeParameterNameReusedInOverloads.ts_0_436 | // @declaration: true
// @skipLibCheck: false
export class Base { foo: string; }
export class Derived extends Base { bar: string; }
export class Derived2 extends Derived { baz: string; }
export type Foo = {
new (x: {
new <T extends Derived>(a: T): T;
new <T extends Base>(a: T): T;
}): any[];
... | {
"end_byte": 436,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitTypeParameterNameReusedInOverloads.ts"
} |
TypeScript/tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment.ts_0_321 | // @module: commonjs
// @declaration: true
// @filename: es6ImportNamedImportInIndirectExportAssignment_0.ts
export module a {
export class c {
}
}
// @filename: es6ImportNamedImportInIndirectExportAssignment_1.ts
import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0";
import x = a;
export = x... | {
"end_byte": 321,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment.ts"
} |
TypeScript/tests/cases/compiler/importNonExportedMember1.ts_0_139 | // @filename: a.ts
declare function foo(): any
declare function bar(): any;
export { foo };
// @filename: b.ts
import { bar } from "./a";
| {
"end_byte": 139,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importNonExportedMember1.ts"
} |
TypeScript/tests/cases/compiler/amdModuleBundleNoDuplicateDeclarationEmitComments.ts_0_246 | //@module: amd
// @declaration: true
// @outFile: ./out.js
// @filename: file1.ts
/// <amd-module name="mynamespace::SomeModuleA" />
export class Foo {}
// @filename: file2.ts
/// <amd-module name="mynamespace::SomeModuleB" />
export class Bar {} | {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/amdModuleBundleNoDuplicateDeclarationEmitComments.ts"
} |
TypeScript/tests/cases/compiler/ClassDeclaration26.ts_0_76 | class C {
public const var export foo = 10;
var constructor() { }
} | {
"end_byte": 76,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ClassDeclaration26.ts"
} |
TypeScript/tests/cases/compiler/controlFlowForCatchAndFinally.ts_0_1162 | // @strict: true
// @lib: es6
type Page = {close(): Promise<void>; content(): Promise<string>};
type Browser = {close(): Promise<void>};
declare function test1(): Promise<Browser>;
declare function test2(obj: Browser): Promise<Page>;
async function test(): Promise<string> {
let browser: Browser | undefined = undefi... | {
"end_byte": 1162,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/controlFlowForCatchAndFinally.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationLetDeclarationOrder2.ts_0_138 | // @allowJs: true
// @outFile: out.js
// @declaration: true
// @filename: a.ts
let b = 30;
a = 10;
// @filename: b.js
let a = 10;
b = 30;
| {
"end_byte": 138,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationLetDeclarationOrder2.ts"
} |
TypeScript/tests/cases/compiler/contextualTypesNegatedTypeLikeConstraintInGenericMappedType2.ts_0_595 | // @strict: true
// @noEmit: true
type Tags<D extends string, P> = P extends Record<D, infer X> ? X : never;
declare const typeTags: <I>() => <
P extends {
readonly [Tag in Tags<"_tag", I> & string]: (
_: Extract<I, { readonly _tag: Tag }>,
) => any;
} & { readonly [Tag in Exclude<keyof P, Tags<"_ta... | {
"end_byte": 595,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTypesNegatedTypeLikeConstraintInGenericMappedType2.ts"
} |
TypeScript/tests/cases/compiler/isolatedModulesNonAmbientConstEnum.ts_0_118 | // @isolatedModules: true
// @target: es6
// @filename: file1.ts
const enum E { X = 100 };
var e = E.X;
export var x; | {
"end_byte": 118,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesNonAmbientConstEnum.ts"
} |
TypeScript/tests/cases/compiler/inheritanceMemberPropertyOverridingProperty.ts_0_76 | class a {
x: () => string;
}
class b extends a {
x: () => string;
} | {
"end_byte": 76,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritanceMemberPropertyOverridingProperty.ts"
} |
TypeScript/tests/cases/compiler/typeReferenceDirectives5.ts_0_357 | // @noImplicitReferences: true
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @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": 357,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeReferenceDirectives5.ts"
} |
TypeScript/tests/cases/compiler/privacyTypeParametersOfClass.ts_0_961 | // @module: commonjs
class privateClass {
}
export class publicClass {
}
// TypeParameter_0_of_exported_class_1_has_or_is_using_private_type_2
export class publicClassWithPrivateTypeParameters<T extends privateClass> {
myMethod(val: T): T { // Error
return val;
}
}
export class publicClassWithPublicT... | {
"end_byte": 961,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyTypeParametersOfClass.ts"
} |
TypeScript/tests/cases/compiler/commentsBeforeVariableStatement1.ts_0_82 | // @module: amd
// @removeComments: false
/** b's comment*/
export var b: number;
| {
"end_byte": 82,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsBeforeVariableStatement1.ts"
} |
TypeScript/tests/cases/compiler/divergentAccessors1.ts_0_472 | // @strict: true
// Accessors in interfaces/types
{
interface IHasGetSet {
get foo(): number;
set foo(v: number | string);
}
const ihgs: IHasGetSet = null as any;
ihgs.foo = "32";
let r_ihgs_foo: number = ihgs.foo;
}
{
type T_HasGetSet = {
get foo(): number;
... | {
"end_byte": 472,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/divergentAccessors1.ts"
} |
TypeScript/tests/cases/compiler/constDeclarations-access3.ts_0_362 | // @target: ES6
module M {
export const x = 0;
}
// Errors
M.x = 1;
M.x += 2;
M.x -= 3;
M.x *= 4;
M.x /= 5;
M.x %= 6;
M.x <<= 7;
M.x >>= 8;
M.x >>>= 9;
M.x &= 10;
M.x |= 11;
M.x ^= 12;
M.x++;
M.x--;
++M.x;
--M.x;
++((M.x));
M["x"] = 0;
// OK
var a = M.x + 1;
function f(v: number) { }
f(M.x);
if (M.x) { }
... | {
"end_byte": 362,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/constDeclarations-access3.ts"
} |
TypeScript/tests/cases/compiler/moduleScopingBug.ts_0_280 | module M
{
var outer: number;
function f() {
var inner = outer; // Ok
}
class C {
constructor() {
var inner = outer; // Ok
}
}
module X {
var inner = outer; // Error: outer not visible
}
}
| {
"end_byte": 280,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleScopingBug.ts"
} |
TypeScript/tests/cases/compiler/mappedTypeCircularReferenceInAccessor.ts_0_338 | interface User {
firstName: string,
level: number,
get bestFriend(): User
set bestFriend(user: SerializablePartial<User>)
}
type FilteredKeys<T> = { [K in keyof T]: T[K] extends number ? K : T[K] extends string ? K : T[K] extends boolean ? K : never }[keyof T];
type SerializablePartial<T> = {
[K in Filtered... | {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mappedTypeCircularReferenceInAccessor.ts"
} |
TypeScript/tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts_0_211 | interface IDef {
p1: (e:string) => void;
p2: () => (n: number) => any;
}
class TestController {
public m(def: IDef) { }
public p = this.m({
p1: e => { },
p2: () => { return vvvvvvvvv => this; },
});
}
| {
"end_byte": 211,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts"
} |
TypeScript/tests/cases/compiler/expandoFunctionExpressionsWithDynamicNames2.ts_0_290 | // @strict: true
// @lib: esnext
// @noEmit: true
const mySymbol = Symbol();
interface Foo {
(): void;
[mySymbol]: true;
}
const foo: Foo = () => {};
foo[mySymbol] = true;
interface Bar {
(): void;
test: true;
}
const t = "test" as const;
const bar: Bar = () => {};
bar[t] = true; | {
"end_byte": 290,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/expandoFunctionExpressionsWithDynamicNames2.ts"
} |
TypeScript/tests/cases/compiler/expandoFunctionSymbolPropertyJs.ts_0_423 | // @strict: true
// @lib: esnext
// @allowJs: true
// @checkJs: true
// @declaration: true
// @outDir: dist
// @filename: /types.ts
export const symb = Symbol();
export interface TestSymb {
(): void;
readonly [symb]: boolean;
}
// @filename: /a.js
import { symb } from "./types";
/**
* @returns {import("./types... | {
"end_byte": 423,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/expandoFunctionSymbolPropertyJs.ts"
} |
TypeScript/tests/cases/compiler/exportStarForValues5.ts_0_126 | // @module: amd
// @filename: file1.ts
export interface Foo { x }
// @filename: file2.ts
export * from "file1"
export var x; | {
"end_byte": 126,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportStarForValues5.ts"
} |
TypeScript/tests/cases/compiler/typeAliasDeclarationEmit2.ts_0_87 | // @target: ES5
// @module: AMD
// @declaration: true
export type A<a> = { value: a }; | {
"end_byte": 87,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeAliasDeclarationEmit2.ts"
} |
TypeScript/tests/cases/compiler/prototypeInstantiatedWithBaseConstraint.ts_0_90 | class C<T> {
x: T;
}
C.prototype.x.boo; // No error, prototype is instantiated to any | {
"end_byte": 90,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/prototypeInstantiatedWithBaseConstraint.ts"
} |
TypeScript/tests/cases/compiler/aliasBug.ts_0_380 | // @module: commonjs
module foo {
export class Provide {
}
export module bar { export module baz {export class boo {}}}
}
import provide = foo;
import booz = foo.bar.baz;
var p = new provide.Provide();
function use() {
var p1: provide.Provide; // error here, but should be okay
var p2: foo.Provi... | {
"end_byte": 380,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/aliasBug.ts"
} |
TypeScript/tests/cases/compiler/letDeclarations-scopes-duplicates7.ts_0_91 | // @target: ES6
// @Filename: file1.ts
let var1 = 0;
// @Filename: file2.ts
var var1 = 0; | {
"end_byte": 91,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/letDeclarations-scopes-duplicates7.ts"
} |
TypeScript/tests/cases/compiler/jsxLibraryManagedAttributesUnusedGeneric.tsx_0_903 | // @jsx: react
// @jsxFactory: jsx
// @ts-ignore
import React from 'react'
declare const jsx: typeof React.createElement
namespace jsx {
export namespace JSX {
export interface Element {}
export interface ElementClass {}
export interface ElementAttributesProperty {}
export interface... | {
"end_byte": 903,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxLibraryManagedAttributesUnusedGeneric.tsx"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.