_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/compiler/globalIsContextualKeyword.ts_0_162 | function a() {
let global = 1;
}
function b() {
class global {}
}
namespace global {
}
function foo(global: number) {
}
let obj = {
global: "123"
} | {
"end_byte": 162,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/globalIsContextualKeyword.ts"
} |
TypeScript/tests/cases/compiler/sourceMapValidationClass.ts_0_432 | // @sourcemap: true
// @target: es5
class Greeter {
constructor(public greeting: string, ...b: string[]) {
}
greet() {
return "<h1>" + this.greeting + "</h1>";
}
private x: string;
private x1: number = 10;
private fn() {
return this.greeting;
}
get greetings() {
return this.greeting;
}
set greetings(greetings: string) {
this.greeting = greetings;
}
} | {
"end_byte": 432,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationClass.ts"
} |
TypeScript/tests/cases/compiler/asyncArrowInClassES5.ts_0_199 | // @noEmitHelpers: true
// @lib: es2015
// @target: es5
// https://github.com/Microsoft/TypeScript/issues/16924
// Should capture `this`
class Test {
static member = async (x: string) => { };
}
| {
"end_byte": 199,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/asyncArrowInClassES5.ts"
} |
TypeScript/tests/cases/compiler/interfaceContextualType.ts_0_379 | //@module: commonjs
export interface IOptions {
italic?: boolean;
bold?: boolean;
}
export interface IMap {
[s: string]: IOptions;
}
class Bug {
public values: IMap;
ok() {
this.values = {};
this.values['comments'] = { italic: true };
}
shouldBeOK() {
this.values = {
comments: { italic: true }
};
}
}
| {
"end_byte": 379,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/interfaceContextualType.ts"
} |
TypeScript/tests/cases/compiler/tooFewArgumentsInGenericFunctionTypedArgument.ts_0_482 | interface Collection<T, U> {
length: number;
add(x: T, y: U): void;
remove(x: T, y: U): boolean;
}
interface Combinators {
map<T, U, V>(c: Collection<T,U>, f: (x: T, y: U) => V): Collection<T, V>;
map<T, U>(c: Collection<T,U>, f: (x: T, y: U) => any): Collection<any, any>;
}
var c2: Collection<number, string>;
var _: Combinators;
var r1a = _.map(c2, (x) => { return x.toFixed() });
var rf1 = (x: number) => { return x.toFixed() };
var r1b = _.map(c2, rf1);
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/tooFewArgumentsInGenericFunctionTypedArgument.ts"
} |
TypeScript/tests/cases/compiler/amdDependencyComment1.ts_0_86 | //@module: commonjs
///<amd-dependency path='bar'/>
import m1 = require("m2")
m1.f(); | {
"end_byte": 86,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/amdDependencyComment1.ts"
} |
TypeScript/tests/cases/compiler/genericSpecializations1.ts_0_375 | interface IFoo<T> {
foo<T>(x: T): T; // no error on implementors because IFoo's T is different from foo's T
}
class IntFooBad implements IFoo<number> {
foo(x: string): string { return null; }
}
class StringFoo2 implements IFoo<string> {
foo(x: string): string { return null; }
}
class StringFoo3 implements IFoo<string> {
foo<T>(x: T): T { return null; }
} | {
"end_byte": 375,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericSpecializations1.ts"
} |
TypeScript/tests/cases/compiler/symbolLinkDeclarationEmitModuleNamesImportRef.ts_0_832 | // @declaration: true
// @useCaseSensitiveFileNames: false
// @noImplicitReferences: true
// @filename: Folder/monorepo/package-a/index.d.ts
export declare const styles: import("styled-components").InterpolationValue[];
// @filename: Folder/node_modules/styled-components/package.json
{
"name": "styled-components",
"version": "3.3.3",
"typings": "typings/styled-components.d.ts"
}
// @filename: Folder/node_modules/styled-components/typings/styled-components.d.ts
export interface InterpolationValue {}
// @filename: Folder/monorepo/core/index.ts
import { styles } from "package-a";
export function getStyles() {
return styles;
}
// @link: Folder/node_modules/styled-components -> Folder/monorepo/package-a/node_modules/styled-components
// @link: Folder/monorepo/package-a -> Folder/monorepo/core/node_modules/package-a | {
"end_byte": 832,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/symbolLinkDeclarationEmitModuleNamesImportRef.ts"
} |
TypeScript/tests/cases/compiler/reboundBaseClassSymbol.ts_0_98 | interface A { a: number; }
module Foo {
var A = 1;
interface B extends A { b: string; }
} | {
"end_byte": 98,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reboundBaseClassSymbol.ts"
} |
TypeScript/tests/cases/compiler/genericObjectSpreadResultInSwitch.ts_0_586 | type Params = {
foo: string;
} & ({ tag: 'a'; type: number } | { tag: 'b'; type: string });
const getType = <P extends Params>(params: P) => {
const {
// Omit
foo,
...rest
} = params;
return rest;
};
declare const params: Params;
switch (params.tag) {
case 'a': {
// TS 4.2: number
// TS 4.3: string | number
const result = getType(params).type;
break;
}
case 'b': {
// TS 4.2: string
// TS 4.3: string | number
const result = getType(params).type;
break;
}
} | {
"end_byte": 586,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericObjectSpreadResultInSwitch.ts"
} |
TypeScript/tests/cases/compiler/commentOnParameter1.ts_3_128 | nction commentedParameters(
/* Parameter a */
a
/* End of parameter a */
/* Parameter b */
,
b
/* End of parameter b */
){} | {
"end_byte": 128,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentOnParameter1.ts"
} |
TypeScript/tests/cases/compiler/unusedLocalsAndObjectSpread.ts_0_707 | // @lib: es5
// @noUnusedLocals:true
declare var console: { log(a: any): void };
function one() {
const foo = { a: 1, b: 2 };
// 'a' is declared but never used
const {a, ...bar} = foo;
console.log(bar);
}
function two() {
const foo = { a: 1, b: 2 };
// '_' is declared but never used
const {a: _, ...bar} = foo;
console.log(bar);
}
function three() {
const foo = { a: 1, b: 2 };
// 'a' is declared but never used
const {a, ...bar} = foo; // bar should be unused
//console.log(bar);
}
function four() {
const foo = { a: 1, b: 2 };
// '_' is declared but never used
const {a: _, ...bar} = foo; // bar should be unused
//console.log(bar);
}
| {
"end_byte": 707,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedLocalsAndObjectSpread.ts"
} |
TypeScript/tests/cases/compiler/assignToModule.ts_0_41 | module A {}
A = undefined; // invalid LHS | {
"end_byte": 41,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignToModule.ts"
} |
TypeScript/tests/cases/compiler/es5-commonjs6.ts_0_125 | // @target: ES5
// @sourcemap: false
// @declaration: false
// @module: commonjs
export default "test";
var __esModule = 1;
| {
"end_byte": 125,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-commonjs6.ts"
} |
TypeScript/tests/cases/compiler/functionCall11.ts_0_110 | function foo(a:string, b?:number){}
foo('foo', 1);
foo('foo');
foo();
foo(1, 'bar');
foo('foo', 1, 'bar');
| {
"end_byte": 110,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionCall11.ts"
} |
TypeScript/tests/cases/compiler/interfaceImplementation6.ts_0_293 | //@module: amd
interface I1 {
item:number;
}
class C1 implements I1 {
public item:number;
}
class C2 implements I1 {
private item:number;
}
class C3 implements I1 {
constructor() {
var item: number;
}
}
export class Test {
private pt: I1 = { item: 1 };
}
| {
"end_byte": 293,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/interfaceImplementation6.ts"
} |
TypeScript/tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts_0_1152 | // @target: es6
// @strictNullChecks: true
declare namespace Windows.Foundation {
interface IPromise<TResult> {
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
cancel(): void;
}
}
async function sample(promise: Windows.Foundation.IPromise<number>) {
var number = await promise;
}
declare function resolve1<T>(value: T): Promise<T>;
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
async function sample2(x?: number) {
let x1 = await resolve1(x);
let x2 = await resolve2(x);
}
| {
"end_byte": 1152,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts"
} |
TypeScript/tests/cases/compiler/unusedTypeParameterInFunction2.ts_0_95 | //@noUnusedLocals:true
//@noUnusedParameters:true
function f1<X, Y>() {
var a: X;
a;
} | {
"end_byte": 95,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedTypeParameterInFunction2.ts"
} |
TypeScript/tests/cases/compiler/decoratorMetadataConditionalType.ts_0_288 | // @experimentalDecorators: true
// @emitDecoratorMetadata: true
declare function d(): PropertyDecorator;
abstract class BaseEntity<T> {
@d()
public attributes: T extends { attributes: infer A } ? A : undefined;
}
class C {
@d()
x: number extends string ? false : true;
} | {
"end_byte": 288,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/decoratorMetadataConditionalType.ts"
} |
TypeScript/tests/cases/compiler/moduleAugmentationExtendAmbientModule2.ts_0_831 | // @module: commonjs
// @declaration: true
// @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>
}
namespace Observable {
let someAnotherValue: string;
}
}
// @filename: observable.d.ts
declare module "observable" {
class Observable<T> {
filter(pred: (e:T) => boolean): Observable<T>;
}
namespace Observable {
export let someValue: number;
}
}
// @filename: main.ts
/// <reference path="observable.d.ts"/>
import { Observable } from "observable"
import "./map";
let x: Observable<number>;
let y = x.map(x => x + 1);
let z1 = Observable.someValue.toFixed();
let z2 = Observable.someAnotherValue.toLowerCase(); | {
"end_byte": 831,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationExtendAmbientModule2.ts"
} |
TypeScript/tests/cases/compiler/unusedVariablesinModules1.ts_0_100 | //@noUnusedLocals:true
//@noUnusedParameters:true
export {};
var x: string;
export var y: string; | {
"end_byte": 100,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedVariablesinModules1.ts"
} |
TypeScript/tests/cases/compiler/declarationMerging2.ts_0_205 | // @module: amd
// @filename: a.ts
export class A {
protected _f: number;
getF() { return this._f; }
}
// @filename: b.ts
export {}
declare module "./a" {
interface A {
run();
}
} | {
"end_byte": 205,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationMerging2.ts"
} |
TypeScript/tests/cases/compiler/forAwaitForUnion.ts_0_141 | // @target: es2018
// @lib: esnext
async function f<T>(source: Iterable<T> | AsyncIterable<T>) {
for await (const x of source) {
}
}
| {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/forAwaitForUnion.ts"
} |
TypeScript/tests/cases/compiler/funduleOfFunctionWithoutReturnTypeAnnotation.ts_0_71 | function fn() {
return fn.n;
}
module fn {
export var n = 1;
}
| {
"end_byte": 71,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/funduleOfFunctionWithoutReturnTypeAnnotation.ts"
} |
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts_0_320 | // @module: commonjs
// @traceResolution: true
// baseurl is defined in tsconfig.json
// paths has errors
// @filename: root/tsconfig.json
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"*1*": [ "*2*" ]
}
}
}
// @filename: root/src/folder1/file1.ts
export var x = 1; | {
"end_byte": 320,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts"
} |
TypeScript/tests/cases/compiler/deepElaborationsIntoArrowExpressions.ts_0_234 | // @target: es6
const a: {
y(): "a"
} = {
y: () => "b"
};
interface Foo {
a: number;
}
function foo1(): () => Foo {
return () => ({a: ''});
}
function foo3(): Foo[] {
return [{a: ''}];
}
var y: Foo[] = [{a: ''}] | {
"end_byte": 234,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deepElaborationsIntoArrowExpressions.ts"
} |
TypeScript/tests/cases/compiler/doubleUnderscoreExportStarConflict.ts_0_212 | // @module: commonjs
// @filename: index.tsx
export * from "./b";
export * from "./c";
// @filename: b.ts
export function __foo(): number | void {}
// @filename: c.ts
export function __foo(): string | void {}
| {
"end_byte": 212,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/doubleUnderscoreExportStarConflict.ts"
} |
TypeScript/tests/cases/compiler/cachedModuleResolution7.ts_0_161 | // @moduleResolution: node
// @traceResolution: true
// @filename: /a/b/c/lib.ts
import {x} from "foo";
// @filename: /a/b/c/d/e/app.ts
import {x} from "foo";
| {
"end_byte": 161,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/cachedModuleResolution7.ts"
} |
TypeScript/tests/cases/compiler/library_ArraySlice.ts_0_141 | // Array.prototype.slice can have zero, one, or two arguments
Array.prototype.slice();
Array.prototype.slice(0);
Array.prototype.slice(0, 1); | {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/library_ArraySlice.ts"
} |
TypeScript/tests/cases/compiler/signatureOverloadsWithComments.ts_0_402 | // @declaration: true
// @emitDeclarationOnly: true
/**
* Docs
*/
function Foo() {
return class Bar {
/**
* comment 1
*/
foo(bar: string): void;
/**
* @deprecated This signature is deprecated
*
* comment 2
*/
foo(): string;
foo(bar?: string): string | void {
return 'hi'
}
}
}
| {
"end_byte": 402,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/signatureOverloadsWithComments.ts"
} |
TypeScript/tests/cases/compiler/incompatibleExports2.ts_0_107 | declare module "foo" {
export interface x { a: string }
interface y { a: Date }
export = y;
} | {
"end_byte": 107,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/incompatibleExports2.ts"
} |
TypeScript/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts_0_497 | // @noemithelpers: true
// @experimentaldecorators: true
// @emitdecoratormetadata: true
// @target: es5
// @module: commonjs
// @filename: db.ts
export class db {
public doSomething() {
}
}
// @filename: service.ts
import database = require('./db');
function someDecorator(target) {
return target;
}
@someDecorator
class MyClass {
db: database.db;
constructor(db: database.db) { // no collision
this.db = db;
this.db.doSomething();
}
}
export {MyClass};
| {
"end_byte": 497,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts"
} |
TypeScript/tests/cases/compiler/jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.tsx_0_495 | // @skipLibCheck: true
// @jsx: react
/// <reference path="/.lib/react16.d.ts" />
import * as React from 'react'
type Tab = [string, React.ReactNode] // [tabName, tabContent]
interface Props {
children: Tab[]
}
function TabLayout(props: Props) {
return <div/>
}
export class App extends React.Component<{}> {
render() {
return <TabLayout>
{[
['Users', <div/>],
['Products', <div/>]
]}
</TabLayout>
}
} | {
"end_byte": 495,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.tsx"
} |
TypeScript/tests/cases/compiler/defaultDeclarationEmitDefaultImport.ts_0_251 | // @declaration: true
// @filename: root.ts
export function getSomething(): Something { return null as any }
export default class Something {}
// @filename: main.ts
import Thing, { getSomething } from "./root";
export const instance = getSomething();
| {
"end_byte": 251,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/defaultDeclarationEmitDefaultImport.ts"
} |
TypeScript/tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty.ts_0_237 | // @module: commonjs
// @filename: es6ImportDefaultBindingNoDefaultProperty_0.ts
export var a = 10;
// @filename: es6ImportDefaultBindingNoDefaultProperty_1.ts
import defaultBinding from "./es6ImportDefaultBindingNoDefaultProperty_0";
| {
"end_byte": 237,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty.ts"
} |
TypeScript/tests/cases/compiler/inferredReturnTypeIncorrectReuse1.ts_0_831 | // @strict: true
// @declaration: true
export type inferPipe<t, pipe> =
pipe extends (In: t) => unknown ? (In: t) => ReturnType<pipe> : never
interface Type<t> {
pipe<fn extends (In: t) => unknown>(fn: fn): Type<inferPipe<t, fn>>
}
declare const t: Type<string>
/** Type<(In: string) => number> */
export const out = t.pipe(s => parseInt(s))
export type inferPipe2<t, pipe> =
pipe extends (In: t) => unknown ?
(In: t) => ReturnType<pipe> extends infer n extends number ? n
: ReturnType<pipe> extends infer s extends string ? s
: ReturnType<pipe> extends infer b extends boolean ? b
: never
: never
interface Type2<t> {
pipe<fn extends (In: t) => unknown>(fn: fn): Type<inferPipe2<t, fn>>
}
declare const t2: Type2<string>
/** Type<(In: string) => number> */
export const out2 = t2.pipe(s => parseInt(s))
| {
"end_byte": 831,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferredReturnTypeIncorrectReuse1.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitInferredTypeAlias7.ts_3_189 | @declaration: true
// @skipDefaultLibCheck: true
// @Filename: 0.ts
export type Data = string | boolean;
let obj: Data = true;
// @Filename: 1.ts
let v = "str" || true;
export { v } | {
"end_byte": 189,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitInferredTypeAlias7.ts"
} |
TypeScript/tests/cases/compiler/tsxResolveExternalModuleExportsTypes.ts_0_438 | // @module: ES2015
// @jsx: preserve
// @libFiles: react.d.ts,lib.d.ts
// @Filename: /node_modules/@types/a/index.d.ts
declare var a: a.Foo;
declare namespace a {
interface Foo {}
}
export = a;
// @Filename: /node_modules/@types/b/index.d.ts
import * as a from 'a';
declare module 'a' {
namespace Test {}
interface Foo {
Test: null;
}
}
// @Filename: foo.tsx
import { Test } from 'a';
const Foo = (<h1></h1>);
| {
"end_byte": 438,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/tsxResolveExternalModuleExportsTypes.ts"
} |
TypeScript/tests/cases/compiler/isolatedModules_resolveJsonModule.ts_0_133 | // @isolatedModules: true
// @resolveJsonModule: true
// @Filename: /a.ts
import j = require("./j.json");
// @Filename: /j.json
{}
| {
"end_byte": 133,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModules_resolveJsonModule.ts"
} |
TypeScript/tests/cases/compiler/collisionRestParameterClassMethod.ts_0_1083 | class c1 {
public foo(_i: number, ...restParameters) { //_i is error
var _i = 10; // no error
}
public fooNoError(_i: number) { // no error
var _i = 10; // no error
}
public f4(_i: number, ...rest); // no codegen no error
public f4(_i: string, ...rest); // no codegen no error
public f4(_i: any, ...rest) { // error
var _i: any; // no error
}
public f4NoError(_i: number); // no error
public f4NoError(_i: string); // no error
public f4NoError(_i: any) { // no error
var _i: any; // no error
}
}
declare class c2 {
public foo(_i: number, ...restParameters); // No error - no code gen
public fooNoError(_i: number); // no error
public f4(_i: number, ...rest); // no codegen no error
public f4(_i: string, ...rest); // no codegen no error
public f4NoError(_i: number); // no error
public f4NoError(_i: string); // no error
}
class c3 {
public foo(...restParameters) {
var _i = 10; // no error
}
public fooNoError() {
var _i = 10; // no error
}
} | {
"end_byte": 1083,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionRestParameterClassMethod.ts"
} |
TypeScript/tests/cases/compiler/typeAssignabilityErrorMessage.ts_0_765 | // @strict: true
// @target: es2020
// @noEmit: true
// Example: different error code altogether
interface ThroughStream {
a: string;
}
interface ReadStream {
f: string;
g: number;
h: boolean;
i: BigInt;
j: symbol;
}
function foo(): ReadStream {
return undefined as any as ThroughStream;
}
function bar(): ReadStream {
return undefined as any as ThroughStream;
}
// Example: different elaboration
type Wrap = {
someProp: Bar<number>;
}
type OtherWrap = {
someProp: Foo<string>;
}
type Foo<T> = {
foo: { what: T };
}
type Bar<T> = {
foo: { what: T };
} | boolean;
function fun(param: Wrap): void {}
declare let fooStr: Foo<string>;
declare let otherWrap: OtherWrap;
let a: Bar<number> = fooStr;
fun(otherWrap); | {
"end_byte": 765,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeAssignabilityErrorMessage.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitForTypesWhichNeedImportTypes.ts_0_213 | // @declaration: true
// @filename: b.ts
export interface Named {}
export function createNamed(): Named {
return {};
}
// @filename: a.ts
import { createNamed } from "./b";
export const Value = createNamed();
| {
"end_byte": 213,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitForTypesWhichNeedImportTypes.ts"
} |
TypeScript/tests/cases/compiler/privacyGloVar.ts_0_2558 | module m1 {
export class C1_public {
private f1() {
}
}
class C2_private {
}
export class C3_public {
private C3_v1_private: C1_public;
public C3_v2_public: C1_public;
private C3_v3_private: C2_private;
public C3_v4_public: C2_private; // error
private C3_v11_private = new C1_public();
public C3_v12_public = new C1_public();
private C3_v13_private = new C2_private();
public C3_v14_public = new C2_private(); // error
private C3_v21_private: C1_public = new C1_public();
public C3_v22_public: C1_public = new C1_public();
private C3_v23_private: C2_private = new C2_private();
public C3_v24_public: C2_private = new C2_private(); // error
}
class C4_public {
private C4_v1_private: C1_public;
public C4_v2_public: C1_public;
private C4_v3_private: C2_private;
public C4_v4_public: C2_private;
private C4_v11_private = new C1_public();
public C4_v12_public = new C1_public();
private C4_v13_private = new C2_private();
public C4_v14_public = new C2_private();
private C4_v21_private: C1_public = new C1_public();
public C4_v22_public: C1_public = new C1_public();
private C4_v23_private: C2_private = new C2_private();
public C4_v24_public: C2_private = new C2_private();
}
var m1_v1_private: C1_public;
export var m1_v2_public: C1_public;
var m1_v3_private: C2_private;
export var m1_v4_public: C2_private; // error
var m1_v11_private = new C1_public();
export var m1_v12_public = new C1_public();
var m1_v13_private = new C2_private();
export var m1_v14_public = new C2_private(); //error
var m1_v21_private: C1_public = new C1_public();
export var m1_v22_public: C1_public = new C1_public();
var m1_v23_private: C2_private = new C2_private();
export var m1_v24_public: C2_private = new C2_private(); // error
}
class glo_C1_public {
private f1() {
}
}
class glo_C3_public {
private glo_C3_v1_private: glo_C1_public;
public glo_C3_v2_public: glo_C1_public;
private glo_C3_v11_private = new glo_C1_public();
public glo_C3_v12_public = new glo_C1_public();
private glo_C3_v21_private: glo_C1_public = new glo_C1_public();
public glo_C3_v22_public: glo_C1_public = new glo_C1_public();
}
var glo_v2_public: glo_C1_public;
var glo_v12_public = new glo_C1_public();
var glo_v22_public: glo_C1_public = new glo_C1_public();
| {
"end_byte": 2558,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyGloVar.ts"
} |
TypeScript/tests/cases/compiler/mappedToToIndexSignatureInference.ts_0_303 | declare const fn: <K extends string, V>(object: { [Key in K]: V }) => object;
declare const a: { [index: string]: number };
fn(a);
// Repro from #30218
declare function enumValues<K extends string, V extends string>(e: Record<K, V>): V[];
enum E { A = 'foo', B = 'bar' }
let x: E[] = enumValues(E);
| {
"end_byte": 303,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mappedToToIndexSignatureInference.ts"
} |
TypeScript/tests/cases/compiler/switchCases.ts_0_31 | switch(0) {
case 1:
break;
}
| {
"end_byte": 31,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/switchCases.ts"
} |
TypeScript/tests/cases/compiler/duplicateIdentifierRelatedSpans7.ts_0_818 | // @pretty: true
// @filename: file1.ts
declare module "someMod" {
export interface TopLevel {
duplicate1: () => string;
duplicate2: () => string;
duplicate3: () => string;
duplicate4: () => string;
duplicate5: () => string;
duplicate6: () => string;
duplicate7: () => string;
duplicate8: () => string;
duplicate9: () => string;
}
}
// @filename: file2.ts
/// <reference path="./file1" />
declare module "someMod" {
export interface TopLevel {
duplicate1(): number;
duplicate2(): number;
duplicate3(): number;
duplicate4(): number;
duplicate5(): number;
duplicate6(): number;
duplicate7(): number;
duplicate8(): number;
duplicate9(): number;
}
}
export {};
| {
"end_byte": 818,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/duplicateIdentifierRelatedSpans7.ts"
} |
TypeScript/tests/cases/compiler/assignmentCompatForEnums.ts_0_181 | enum TokenType { One, Two };
var list = {};
function returnType(): TokenType { return null; }
function foo() {
var x = returnType();
var x: TokenType = list['one'];
}
| {
"end_byte": 181,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatForEnums.ts"
} |
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.ts_0_1512 | // @noImplicitReferences: true
// @traceResolution: true
// @allowJs: true
// @filename: /root/src/foo.ts
export function foo() {}
// @filename: /root/src/bar.js
export function bar() {}
// @filename: /root/a.ts
import { foo as foo1 } from "/foo";
import { bar as bar1 } from "/bar";
import { foo as foo2 } from "c:/foo";
import { bar as bar2 } from "c:/bar";
import { foo as foo3 } from "c:\\foo";
import { bar as bar3 } from "c:\\bar";
import { foo as foo4 } from "//server/foo";
import { bar as bar4 } from "//server/bar";
import { foo as foo5 } from "\\\\server\\foo";
import { bar as bar5 } from "\\\\server\\bar";
import { foo as foo6 } from "file:///foo";
import { bar as bar6 } from "file:///bar";
import { foo as foo7 } from "file://c:/foo";
import { bar as bar7 } from "file://c:/bar";
import { foo as foo8 } from "file://server/foo";
import { bar as bar8 } from "file://server/bar";
import { foo as foo9 } from "http://server/foo";
import { bar as bar9 } from "http://server/bar";
// @filename: /root/tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"/*": ["./src/*"],
"c:/*": ["./src/*"],
"c:\\*": ["./src/*"],
"//server/*": ["./src/*"],
"\\\\server\\*": ["./src/*"],
"file:///*": ["./src/*"],
"file://c:/*": ["./src/*"],
"file://server/*": ["./src/*"],
"http://server/*": ["./src/*"]
},
"allowJs": true,
"outDir": "bin"
}
}
| {
"end_byte": 1512,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.ts"
} |
TypeScript/tests/cases/compiler/typeParameterExplicitlyExtendsAny.ts_0_526 | function fee<T>() {
var t: T;
t.blah; // Error
t.toString; // ok
}
function fee2<T extends any>() {
var t: T;
t.blah; // ok
t.toString; // ok
}
function f<T extends any>(x: T) {
x.children;
x();
new x();
x[100];
x['hello'];
}
// Generic Tree structure
type Tree<T> = T & {
children?: Tree<T>[];
}
class MyClass {
public static displayTree1<T extends Tree<any>>(tree: T) {
// error "Property 'children' does not exist on type 'T'"
tree.children;
}
}
| {
"end_byte": 526,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParameterExplicitlyExtendsAny.ts"
} |
TypeScript/tests/cases/compiler/decoratorMetadataPromise.ts_0_307 | // @experimentaldecorators: true
// @emitdecoratormetadata: true
// @target: es6
declare const decorator: MethodDecorator;
class A {
@decorator
async foo() {}
@decorator
async bar(): Promise<number> { return 0; }
@decorator
baz(n: Promise<number>): Promise<number> { return n; }
}
| {
"end_byte": 307,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/decoratorMetadataPromise.ts"
} |
TypeScript/tests/cases/compiler/declarationEmitHasTypesRefOnNamespaceUse.ts_0_324 | // @declaration: true
// @types: dep
// @typeRoots: /deps
// @currentDirectory: /
// @noImplicitReferences: true
// @filename: /deps/dep/dep.d.ts
declare namespace NS {
interface Dep {
}
}
// @filename: /deps/dep/package.json
{
"typings": "dep.d.ts"
}
// @filename: /src/index.ts
class Src implements NS.Dep { }
| {
"end_byte": 324,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitHasTypesRefOnNamespaceUse.ts"
} |
TypeScript/tests/cases/compiler/privacyLocalInternalReferenceImportWithoutExport.ts_0_6720 | //@module: amd
//@declaration: true
// private elements
module m_private {
export class c_private {
}
export enum e_private {
Happy,
Grumpy
}
export function f_private() {
return new c_private();
}
export var v_private = new c_private();
export interface i_private {
}
export module mi_private {
export class c {
}
}
export module mu_private {
export interface i {
}
}
}
// Public elements
export module m_public {
export class c_public {
}
export enum e_public {
Happy,
Grumpy
}
export function f_public() {
return new c_public();
}
export var v_public = 10;
export interface i_public {
}
export module mi_public {
export class c {
}
}
export module mu_public {
export interface i {
}
}
}
export module import_public {
// No Privacy errors - importing private elements
import im_private_c_private = m_private.c_private;
import im_private_e_private = m_private.e_private;
import im_private_f_private = m_private.f_private;
import im_private_v_private = m_private.v_private;
import im_private_i_private = m_private.i_private;
import im_private_mi_private = m_private.mi_private;
import im_private_mu_private = m_private.mu_private;
// Usage of above decls
var privateUse_im_private_c_private = new im_private_c_private();
export var publicUse_im_private_c_private = new im_private_c_private();
var privateUse_im_private_e_private = im_private_e_private.Happy;
export var publicUse_im_private_e_private = im_private_e_private.Grumpy;
var privateUse_im_private_f_private = im_private_f_private();
export var publicUse_im_private_f_private = im_private_f_private();
var privateUse_im_private_v_private = im_private_v_private;
export var publicUse_im_private_v_private = im_private_v_private;
var privateUse_im_private_i_private: im_private_i_private;
export var publicUse_im_private_i_private: im_private_i_private;
var privateUse_im_private_mi_private = new im_private_mi_private.c();
export var publicUse_im_private_mi_private = new im_private_mi_private.c();
var privateUse_im_private_mu_private: im_private_mu_private.i;
export var publicUse_im_private_mu_private: im_private_mu_private.i;
// No Privacy errors - importing public elements
import im_private_c_public = m_public.c_public;
import im_private_e_public = m_public.e_public;
import im_private_f_public = m_public.f_public;
import im_private_v_public = m_public.v_public;
import im_private_i_public = m_public.i_public;
import im_private_mi_public = m_public.mi_public;
import im_private_mu_public = m_public.mu_public;
// Usage of above decls
var privateUse_im_private_c_public = new im_private_c_public();
export var publicUse_im_private_c_public = new im_private_c_public();
var privateUse_im_private_e_public = im_private_e_public.Happy;
export var publicUse_im_private_e_public = im_private_e_public.Grumpy;
var privateUse_im_private_f_public = im_private_f_public();
export var publicUse_im_private_f_public = im_private_f_public();
var privateUse_im_private_v_public = im_private_v_public;
export var publicUse_im_private_v_public = im_private_v_public;
var privateUse_im_private_i_public: im_private_i_public;
export var publicUse_im_private_i_public: im_private_i_public;
var privateUse_im_private_mi_public = new im_private_mi_public.c();
export var publicUse_im_private_mi_public = new im_private_mi_public.c();
var privateUse_im_private_mu_public: im_private_mu_public.i;
export var publicUse_im_private_mu_public: im_private_mu_public.i;
}
module import_private {
// No Privacy errors - importing private elements
import im_private_c_private = m_private.c_private;
import im_private_e_private = m_private.e_private;
import im_private_f_private = m_private.f_private;
import im_private_v_private = m_private.v_private;
import im_private_i_private = m_private.i_private;
import im_private_mi_private = m_private.mi_private;
import im_private_mu_private = m_private.mu_private;
// Usage of above decls
var privateUse_im_private_c_private = new im_private_c_private();
export var publicUse_im_private_c_private = new im_private_c_private();
var privateUse_im_private_e_private = im_private_e_private.Happy;
export var publicUse_im_private_e_private = im_private_e_private.Grumpy;
var privateUse_im_private_f_private = im_private_f_private();
export var publicUse_im_private_f_private = im_private_f_private();
var privateUse_im_private_v_private = im_private_v_private;
export var publicUse_im_private_v_private = im_private_v_private;
var privateUse_im_private_i_private: im_private_i_private;
export var publicUse_im_private_i_private: im_private_i_private;
var privateUse_im_private_mi_private = new im_private_mi_private.c();
export var publicUse_im_private_mi_private = new im_private_mi_private.c();
var privateUse_im_private_mu_private: im_private_mu_private.i;
export var publicUse_im_private_mu_private: im_private_mu_private.i;
// No privacy Error - importing public elements
import im_private_c_public = m_public.c_public;
import im_private_e_public = m_public.e_public;
import im_private_f_public = m_public.f_public;
import im_private_v_public = m_public.v_public;
import im_private_i_public = m_public.i_public;
import im_private_mi_public = m_public.mi_public;
import im_private_mu_public = m_public.mu_public;
// Usage of above decls
var privateUse_im_private_c_public = new im_private_c_public();
export var publicUse_im_private_c_public = new im_private_c_public();
var privateUse_im_private_e_public = im_private_e_public.Happy;
export var publicUse_im_private_e_public = im_private_e_public.Grumpy;
var privateUse_im_private_f_public = im_private_f_public();
export var publicUse_im_private_f_public = im_private_f_public();
var privateUse_im_private_v_public = im_private_v_public;
export var publicUse_im_private_v_public = im_private_v_public;
var privateUse_im_private_i_public: im_private_i_public;
export var publicUse_im_private_i_public: im_private_i_public;
var privateUse_im_private_mi_public = new im_private_mi_public.c();
export var publicUse_im_private_mi_public = new im_private_mi_public.c();
var privateUse_im_private_mu_public: im_private_mu_public.i;
export var publicUse_im_private_mu_public: im_private_mu_public.i;
} | {
"end_byte": 6720,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyLocalInternalReferenceImportWithoutExport.ts"
} |
TypeScript/tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts_0_6192 | // @module: commonjs
// @declaration: true
// @Filename: privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts
declare module "GlobalWidgets" {
export class Widget3 {
name: string;
}
export function createWidget3(): Widget3;
export module SpecializedGlobalWidget {
export class Widget4 {
name: string;
}
function createWidget4(): Widget4;
}
}
// @Filename: privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts
export class Widget1 {
name = 'one';
}
export function createWidget1() {
return new Widget1();
}
export module SpecializedWidget {
export class Widget2 {
name = 'one';
}
export function createWidget2() {
return new Widget2();
}
}
// @Filename:privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts
///<reference path='privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts'/>
import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets");
import Widgets1 = require("GlobalWidgets");
export function createExportedWidget1() {
return Widgets.createWidget1();
}
export function createExportedWidget2() {
return Widgets.SpecializedWidget.createWidget2();
}
export function createExportedWidget3() {
return Widgets1.createWidget3();
}
export function createExportedWidget4() {
return Widgets1.SpecializedGlobalWidget.createWidget4();
}
// @Filename:privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts
import exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter");
export class publicClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error
}
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
}
myPublicMethod(param = exporter.createExportedWidget1()) { // Error
}
private myPrivateMethod(param = exporter.createExportedWidget1()) {
}
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error
}
}
export class publicClassWithWithPrivateParmeterTypes1 {
static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error
}
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
}
myPublicMethod(param = exporter.createExportedWidget3()) { // Error
}
private myPrivateMethod(param = exporter.createExportedWidget3()) {
}
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error
}
}
class privateClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param = exporter.createExportedWidget1()) {
}
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
}
myPublicMethod(param = exporter.createExportedWidget1()) {
}
private myPrivateMethod(param = exporter.createExportedWidget1()) {
}
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) {
}
}
class privateClassWithWithPrivateParmeterTypes2 {
static myPublicStaticMethod(param = exporter.createExportedWidget3()) {
}
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
}
myPublicMethod(param = exporter.createExportedWidget3()) {
}
private myPrivateMethod(param = exporter.createExportedWidget3()) {
}
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) {
}
}
export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error
}
function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) {
}
export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error
}
function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) {
}
export class publicClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error
}
myPublicMethod(param= exporter.createExportedWidget2()) { // Error
}
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error
}
}
export class publicClassWithPrivateModuleParameterTypes2 {
static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error
}
myPublicMethod(param= exporter.createExportedWidget4()) { // Error
}
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error
}
}
export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error
}
export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error
}
class privateClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param= exporter.createExportedWidget2()) {
}
myPublicMethod(param= exporter.createExportedWidget2()) {
}
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) {
}
}
class privateClassWithPrivateModuleParameterTypes1 {
static myPublicStaticMethod(param= exporter.createExportedWidget4()) {
}
myPublicMethod(param= exporter.createExportedWidget4()) {
}
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) {
}
}
function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) {
}
function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) {
} | {
"end_byte": 6192,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts"
} |
TypeScript/tests/cases/compiler/privacyCheckAnonymousFunctionParameter.ts_0_365 | //@module: commonjs
//@declaration: true
export var x = 1; // Makes this an external module
interface Iterator<T> {
}
module Query {
export function fromDoWhile<T>(doWhile: (test: Iterator<T>) => boolean): Iterator<T> {
return null;
}
function fromOrderBy() {
return fromDoWhile(test => {
return true;
});
}
}
| {
"end_byte": 365,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyCheckAnonymousFunctionParameter.ts"
} |
TypeScript/tests/cases/compiler/numericIndexerConstraint5.ts_0_76 | var x = { name: "x", 0: new Date() };
var z: { [name: number]: string } = x; | {
"end_byte": 76,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/numericIndexerConstraint5.ts"
} |
TypeScript/tests/cases/compiler/moduleAugmentationCollidingNamesInAugmentation1.ts_0_627 | // @module: amd
// @declaration: true
// @filename: map1.ts
import { Observable } from "./observable"
(<any>Observable.prototype).map = function() { }
declare module "./observable" {
interface I {x0}
}
// @filename: map2.ts
import { Observable } from "./observable"
(<any>Observable.prototype).map = function() { }
declare module "./observable" {
interface I {x1}
}
// @filename: observable.ts
export declare class Observable<T> {
filter(pred: (e:T) => boolean): Observable<T>;
}
// @filename: main.ts
import { Observable } from "./observable"
import "./map1";
import "./map2";
let x: Observable<number>;
| {
"end_byte": 627,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationCollidingNamesInAugmentation1.ts"
} |
TypeScript/tests/cases/compiler/mergeWithImportedNamespace.ts_0_180 | // @module:commonjs
// @filename: f1.ts
export namespace N { export var x = 1; }
// @filename: f2.ts
import {N} from "./f1";
export namespace N {
export interface I {x: any}
} | {
"end_byte": 180,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mergeWithImportedNamespace.ts"
} |
TypeScript/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts_0_941 | // @target: es6
// @module: commonjs
// @declaration: true
// @filename: es6ImportDefaultBindingFollowedWithNamedImport_0.ts
export var a = 10;
export var x = a;
export var m = a;
export default {};
// @filename: es6ImportDefaultBindingFollowedWithNamedImport_1.ts
import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = a;
import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = b;
import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = x;
var x1: number = y;
import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = z;
import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = m;
| {
"end_byte": 941,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts"
} |
TypeScript/tests/cases/compiler/genericConstraint3.ts_0_137 | interface C<P> { x: P; }
interface A<T, U extends C<T>> { x: U; }
interface B extends A<{}, { x: {} }> { } // Should not produce an error | {
"end_byte": 137,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericConstraint3.ts"
} |
TypeScript/tests/cases/compiler/classExpressionPropertyModifiers.ts_0_144 | // @noEmit: true
// @noTypesAndSymbols: true
// @lib: es6
const a = class Cat {
declare [Symbol.toStringTag] = "uh";
export foo = 1;
}
| {
"end_byte": 144,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExpressionPropertyModifiers.ts"
} |
TypeScript/tests/cases/compiler/dottedModuleName2.ts_0_292 | module A.B {
export var x = 1;
}
module AA { export module B {
export var x = 1;
} }
var tmpOK = AA.B.x;
var tmpError = A.B.x;
module A.B.C
{
export var x = 1;
}
module M
{
import X1 = A;
import X2 = A.B;
import X3 = A.B.C;
}
| {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/dottedModuleName2.ts"
} |
TypeScript/tests/cases/compiler/requireOfJsonFileWithModuleEmitNone.ts_0_198 | // @module: none
// @outdir: out/
// @fullEmitPaths: true
// @resolveJsonModule: true
// @Filename: file1.ts
import * as b from './b.json';
// @Filename: b.json
{
"a": true,
"b": "hello"
} | {
"end_byte": 198,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireOfJsonFileWithModuleEmitNone.ts"
} |
TypeScript/tests/cases/compiler/pathMappingWithoutBaseUrl1.ts_0_288 | // @noTypesAndSymbols: true
// @Filename: /project/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"paths": {
"p1": ["./lib/p1"]
}
}
}
// @Filename: /project/lib/p1/index.ts
export const p1 = 0;
// @Filename: /project/index.ts
import { p1 } from "p1";
| {
"end_byte": 288,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingWithoutBaseUrl1.ts"
} |
TypeScript/tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts_0_129 | class C { private v; public p; static s; }
class D extends C {
public c() {
v = 1;
this.p = 1;
s = 1;
}
} | {
"end_byte": 129,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts"
} |
TypeScript/tests/cases/compiler/classIndexer4.ts_0_128 | class C123 {
[s: string]: number;
constructor() {
}
}
interface D123 extends C123 {
x: number;
y: string;
} | {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classIndexer4.ts"
} |
TypeScript/tests/cases/compiler/thisInAccessors.ts_0_504 | // this capture only in getter
class GetterOnly {
get Value() {
var fn = () => this;
return '';
}
set Value(val) {
}
}
// this capture only in setter
class SetterOnly {
get Value() {
return '';
}
set Value(val) {
var fn = () => this;
}
}
// this capture only in both setter and getter
class GetterAndSetter {
get Value() {
var fn = () => this;
return '';
}
set Value(val) {
var fn = () => this;
}
} | {
"end_byte": 504,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInAccessors.ts"
} |
TypeScript/tests/cases/compiler/interMixingModulesInterfaces1.ts_0_221 | module A {
export interface B {
name: string;
value: number;
}
export module B {
export function createB(): B {
return null;
}
}
}
var x: A.B = A.B.createB(); | {
"end_byte": 221,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/interMixingModulesInterfaces1.ts"
} |
TypeScript/tests/cases/compiler/aliasesInSystemModule2.ts_0_321 | // @module: system
// @isolatedModules: true
import {alias} from "foo";
import cls = alias.Class;
export import cls2 = alias.Class;
let x = new alias.Class();
let y = new cls();
let z = new cls2();
module M {
export import cls = alias.Class;
let x = new alias.Class();
let y = new cls();
let z = new cls2();
} | {
"end_byte": 321,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/aliasesInSystemModule2.ts"
} |
TypeScript/tests/cases/compiler/lambdaASIEmit.ts_0_94 | // @removeComments: false
function Foo(x: any)
{
}
Foo(() =>
// do something
127);
| {
"end_byte": 94,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/lambdaASIEmit.ts"
} |
TypeScript/tests/cases/compiler/emitSkipsThisWithRestParameter.ts_0_195 | function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any {
return function(this: any, ...args: any[]) {
return fn.apply(this, [ this ].concat(args));
};
}
| {
"end_byte": 195,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/emitSkipsThisWithRestParameter.ts"
} |
TypeScript/tests/cases/compiler/specializedOverloadWithRestParameters.ts_0_369 | class Base { foo() { } }
class Derived1 extends Base { bar() { } }
function f(tagName: 'span', ...args): Derived1; // error
function f(tagName: number, ...args): Base;
function f(tagName: any): Base {
return null;
}
function g(tagName: 'span', arg): Derived1; // error
function g(tagName: number, arg): Base;
function g(tagName: any): Base {
return null;
} | {
"end_byte": 369,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/specializedOverloadWithRestParameters.ts"
} |
TypeScript/tests/cases/compiler/computedTypesKeyofNoIndexSignatureType.ts_0_888 | type Compute<A> = { [K in keyof A]: Compute<A[K]>; } & {};
type EqualsTest<T> = <A>() => A extends T ? 1 : 0;
type Equals<A1, A2> = EqualsTest<A2> extends EqualsTest<A1> ? 1 : 0;
type Filter<K, I> = Equals<K, I> extends 1 ? never : K;
type OmitIndex<T, I extends string | number> = {
[K in keyof T as Filter<K, I>]: T[K];
};
type IndexObject = { [key: string]: unknown; };
type FooBar = { foo: "hello"; bar: "world"; };
type WithIndex = Compute<FooBar & IndexObject>; // { [x: string]: {}; foo: "hello"; bar: "world"; } <-- OK
type WithoutIndex = OmitIndex<WithIndex, string>; // { foo: "hello"; bar: "world"; } <-- OK
type FooBarKey = keyof FooBar; // "foo" | "bar" <-- OK
type WithIndexKey = keyof WithIndex; // string | number <-- Expected: string
type WithoutIndexKey = keyof WithoutIndex; // number <-- Expected: "foo" | "bar" | {
"end_byte": 888,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/computedTypesKeyofNoIndexSignatureType.ts"
} |
TypeScript/tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.ts_0_879 | // @declaration: true
// @filename: workspace/packageA/index.d.ts
export declare class Foo {
private f: any;
}
// @filename: workspace/packageB/package.json
{
"private": true,
"dependencies": {
"package-a": "file:../packageA"
}
}
// @filename: workspace/packageB/index.d.ts
import { Foo } from "package-a";
export declare function invoke(): Foo;
// @filename: workspace/packageC/package.json
{
"private": true,
"dependencies": {
"package-b": "file:../packageB",
"package-a": "file:../packageA"
}
}
// @filename: workspace/packageC/index.ts
import * as pkg from "package-b";
export const a = pkg.invoke();
// @link: workspace/packageA -> workspace/packageC/node_modules/package-a
// @link: workspace/packageA -> workspace/packageB/node_modules/package-a
// @link: workspace/packageB -> workspace/packageC/node_modules/package-b | {
"end_byte": 879,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesNonrelativeName.ts"
} |
TypeScript/tests/cases/compiler/innerBoundLambdaEmit.ts_0_109 | module M {
export class Foo {
}
var bar = () => { };
}
interface Array<T> {
toFoo(): M.Foo
}
| {
"end_byte": 109,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/innerBoundLambdaEmit.ts"
} |
TypeScript/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts_0_141 | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @filename: a.js
// @target: es6
export default class a {
}
export default var a = 10; | {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts"
} |
TypeScript/tests/cases/compiler/alwaysStrictES6.ts_0_80 | // @target: ES6
// @alwaysStrict: true
function f() {
var arguments = [];
} | {
"end_byte": 80,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/alwaysStrictES6.ts"
} |
TypeScript/tests/cases/compiler/functionWithDefaultParameterWithNoStatements7.ts_0_56 | function foo(a = false) { }
function bar(a = false) {
} | {
"end_byte": 56,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionWithDefaultParameterWithNoStatements7.ts"
} |
TypeScript/tests/cases/compiler/contextuallyTypedGenericAssignment.ts_0_127 | function foo<A extends any[]>(
arg: <T extends { a: number }>(t: T, ...rest: A) => number
) { }
foo((t, u: number) => t.a) | {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextuallyTypedGenericAssignment.ts"
} |
TypeScript/tests/cases/compiler/requireOfJsonFileWithoutAllowJs.ts_0_302 | // @module: commonjs
// @outdir: out/
// @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": 302,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireOfJsonFileWithoutAllowJs.ts"
} |
TypeScript/tests/cases/compiler/listFailure.ts_0_863 | module Editor {
export class Buffer {
lines: List<Line> = ListMakeHead<Line>();
addLine(lineText: string): List<Line> {
var line: Line = new Line();
var lineEntry = this.lines.add(line);
return lineEntry;
}
}
export function ListRemoveEntry<U>(entry: List<U>): List<U> {
return entry;
}
export function ListMakeHead<U>(): List<U> {
return null;
}
export function ListMakeEntry<U>(data: U): List<U> {
return null;
}
class List<T> {
public next: List<T>;
add(data: T): List<T> {
this.next = ListMakeEntry(data);
return this.next;
}
popEntry(head: List<T>): List<T> {
return (ListRemoveEntry(this.next));
}
}
export class Line {}
} | {
"end_byte": 863,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/listFailure.ts"
} |
TypeScript/tests/cases/compiler/classExtendsInterface.ts_0_195 | interface Comparable {}
class A extends Comparable {}
class B implements Comparable {}
interface Comparable2<T> {}
class A2<T> extends Comparable2<T> {}
class B2<T> implements Comparable2<T> {}
| {
"end_byte": 195,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExtendsInterface.ts"
} |
TypeScript/tests/cases/compiler/externalModuleResolution.ts_0_255 | //@module: commonjs
// @Filename: foo.d.ts
declare module M1 {
export var X:number;
}
export = M1
// @Filename: foo.ts
module M2 {
export var Y = 1;
}
export = M2
// @Filename: consumer.ts
import x = require('./foo');
x.Y // .ts should be picked | {
"end_byte": 255,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/externalModuleResolution.ts"
} |
TypeScript/tests/cases/compiler/capturedLetConstInLoop14.ts_0_226 | // @strict: true
// @target: es5
// @noTypesAndSymbols: true
function use(v: number) {}
function foo(x: number) {
var v = 1;
do {
let x = v;
var v;
var v = 2;
() => x + v;
} while (false);
use(v);
}
| {
"end_byte": 226,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop14.ts"
} |
TypeScript/tests/cases/compiler/systemDefaultImportCallable.ts_0_397 | // @module: system
// @filename: core-js.d.ts
declare module core {
var String: {
repeat(text: string, count: number): string;
};
}
declare module "core-js/fn/string/repeat" {
var repeat: typeof core.String.repeat;
export default repeat;
}
// @filename: greeter.ts
import repeat from "core-js/fn/string/repeat";
const _: string = repeat(new Date().toUTCString() + " ", 2); | {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/systemDefaultImportCallable.ts"
} |
TypeScript/tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts_0_439 | // @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 { c } from "./server";
export { c as c2 } from "./server";
export { i, m as instantiatedModule } from "./server";
export { uninstantiated } from "./server";
export { x } from "./server"; | {
"end_byte": 439,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts"
} |
TypeScript/tests/cases/compiler/indexTypeCheck.ts_0_946 | interface Red {
[n:number]; // ok
[s:string]; // ok
}
interface Blue {
[n:number]: any; // ok
[s:string]: any; // ok
}
interface Yellow {
[n:number]: Red; // ok
[s:string]: Red; // ok
}
interface Orange {
[n:number]: number; // ok
[s:string]: string; // error
}
interface Green {
[n:number]: Orange; // error
[s:string]: Yellow; // ok
}
interface Cyan {
[n:number]: number; // error
[s:string]: string; // ok
}
interface Purple {
[n:number, s:string]; // error
}
interface Magenta {
[p:Purple]; // error
}
var yellow: Yellow;
var blue: Blue;
var s = "some string";
yellow[5]; // ok
yellow["hue"]; // ok
yellow[<any>{}]; // ok
s[0]; // error
s["s"]; // ok
s[<any>{}]; // ok
yellow[blue]; // error
var x:number[];
x[0];
class Benchmark {
public results: { [x:string]: any; } = <{ [x:string]: any; }>{};
public addTimingFor(name: string, timing: number) {
this.results[name] = this.results[name];
}
} | {
"end_byte": 946,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexTypeCheck.ts"
} |
TypeScript/tests/cases/compiler/spellingSuggestionGlobal4.ts_0_91 | export {}
declare global { var x: any }
global.x // should not suggest `global` (GH#42209)
| {
"end_byte": 91,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spellingSuggestionGlobal4.ts"
} |
TypeScript/tests/cases/compiler/exportAssignClassAndModule.ts_0_352 | // @module: commonjs
// @Filename: exportAssignClassAndModule_0.ts
class Foo {
x: Foo.Bar;
}
module Foo {
export interface Bar {
}
}
export = Foo;
// @Filename: exportAssignClassAndModule_1.ts
///<reference path='exportAssignClassAndModule_0.ts'/>
import Foo = require('./exportAssignClassAndModule_0');
var z: Foo.Bar;
var zz: Foo;
zz.x; | {
"end_byte": 352,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportAssignClassAndModule.ts"
} |
TypeScript/tests/cases/compiler/capturedLetConstInLoop1.ts_0_2241 | declare function use(x: any): any;
//==== let
for (let x in {}) {
(function() { return x});
(() => x);
}
for (let x of []) {
(function() { return x});
(() => x);
}
for (let x = 0; x < 1; ++x) {
(function() { return x});
(() => x);
}
while (1 === 1) {
let x;
(function() { return x});
(() => x);
}
do {
let x;
(function() { return x});
(() => x);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
(function() { return x});
(() => x);
}
for (let x = 0, y = 1; x < 1; ++x) {
(function() { return x + y});
(() => x + y);
}
while (1 === 1) {
let x, y;
(function() { return x + y});
(() => x + y);
}
do {
let x, y;
(function() { return x + y});
(() => x + y);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
(function() { return x + y});
(() => x + y);
}
for (let y = (use(() => y), 0); y < 1; ++y) {
}
for (let y = 0; use(() => y), y < 1; ++y) {
}
for (let y = 0; y < 1; use(() => y), ++y) {
}
for (let y = (use(() => y), 0); use(() => y), y < 1; use(() => y), ++y) {
use(() => y);
}
//=========const
for (const x in {}) {
(function() { return x});
(() => x);
}
for (const x of []) {
(function() { return x});
(() => x);
}
for (const x = 0; x < 1;) {
(function() { return x});
(() => x);
}
while (1 === 1) {
const x = 1;
(function() { return x});
(() => x);
}
do {
const x = 1;
(function() { return x});
(() => x);
} while (1 === 1)
for (const y = 0; y < 1;) {
const x = 1;
(function() { return x});
(() => x);
}
for (const x = 0, y = 1; x < 1;) {
(function() { return x + y});
(() => x + y);
}
while (1 === 1) {
const x = 1, y = 1;
(function() { return x + y});
(() => x + y);
}
do {
const x = 1, y = 1;
(function() { return x + y});
(() => x + y);
} while (1 === 1)
for (const y = 0; y < 1;) {
const x = 1;
(function() { return x + y});
(() => x + y);
}
// https://github.com/Microsoft/TypeScript/issues/20594
declare const sobj: { [x: string]: any };
for (let sx in sobj) {
(() => sobj[sx]);
}
declare const iobj: { [x: number]: any };
for (let ix in iobj) {
(() => iobj[ix]);
} | {
"end_byte": 2241,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop1.ts"
} |
TypeScript/tests/cases/compiler/jsxImportForSideEffectsNonExtantNoError.tsx_0_164 | // @jsx: react
/// <reference path="/.lib/react16.d.ts" />
import * as React from "react";
import "./App.css"; // doesn't actually exist
const tag = <div></div>;
| {
"end_byte": 164,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxImportForSideEffectsNonExtantNoError.tsx"
} |
TypeScript/tests/cases/compiler/inferParameterWithMethodCallInitializer.ts_0_378 | // @noImplicitAny: true
function getNumber(): number {
return 1;
}
class Example {
getNumber(): number {
return 1;
}
doSomething(a = this.getNumber()): typeof a {
return a;
}
}
function weird(this: Example, a = this.getNumber()) {
return a;
}
class Weird {
doSomething(this: Example, a = this.getNumber()) {
return a;
}
}
| {
"end_byte": 378,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferParameterWithMethodCallInitializer.ts"
} |
TypeScript/tests/cases/compiler/genericParameterAssignability1.ts_0_91 | function f<T>(x: T): T { return null; }
var r = <T>(x: T) => x;
r = f; // should be allowed | {
"end_byte": 91,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericParameterAssignability1.ts"
} |
TypeScript/tests/cases/compiler/unusedInterfaceinNamespace1.ts_0_101 | //@noUnusedLocals:true
//@noUnusedParameters:true
namespace Validation {
interface i1 {
}
} | {
"end_byte": 101,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedInterfaceinNamespace1.ts"
} |
TypeScript/tests/cases/compiler/typeParameterDiamond2.ts_0_323 | function diamondTop<Top>() {
function diamondMiddle<T extends Top, U>() {
function diamondBottom<Bottom extends T | U>() {
var top: Top;
var middle: T | U;
var bottom: Bottom;
top = middle;
middle = bottom;
top = bottom;
}
}
} | {
"end_byte": 323,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParameterDiamond2.ts"
} |
TypeScript/tests/cases/compiler/jsxHash.tsx_0_292 | //@jsx: preserve
var t02 = <a>{0}#</a>;
var t03 = <a>#{0}</a>;
var t04 = <a>#{0}#</a>;
var t05 = <a>#<i></i></a>;
var t06 = <a>#<i></i></a>;
var t07 = <a>#<i>#</i></a>;
var t08 = <a><i></i>#</a>;
var t09 = <a>#<i></i>#</a>;
var t10 = <a><i/>#</a>;
var t11 = <a>#<i/></a>;
var t12 = <a>#</a>;
| {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxHash.tsx"
} |
TypeScript/tests/cases/compiler/declaredExternalModule.ts_0_477 | declare module 'connect' {
interface connectModule {
(res, req, next): void;
}
interface connectExport {
use: (mod: connectModule) => connectExport;
listen: (port: number) => void;
}
var server: {
(): connectExport;
test1: connectModule; // No error
test2(): connectModule; // ERROR: Return type of method from exported interface has or is using private type ''connect'.connectModule'.
};
}
| {
"end_byte": 477,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declaredExternalModule.ts"
} |
TypeScript/tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts_0_140 | // @strict: true
interface Foo { bar: any; }
const bar: { [id: string]: number } = {};
(foo: Foo) => {
bar[id]++;
const id = foo.bar;
}
| {
"end_byte": 140,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts"
} |
TypeScript/tests/cases/compiler/isolatedModulesPlainFile-AMD.ts_0_106 | // @target: es5
// @module: amd
// @isolatedModules: true
declare function run(a: number): void;
run(1);
| {
"end_byte": 106,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesPlainFile-AMD.ts"
} |
TypeScript/tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts_0_113 | class A {
aProp: string;
}
module A {
export interface X { s: string }
}
module B {
import Y = A;
}
| {
"end_byte": 113,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts"
} |
TypeScript/tests/cases/compiler/exportDefaultImportedType.ts_0_188 | // @module: es2015
// @noTypesAndSymbols: true
// @Filename: /exported.ts
type Foo = number;
export { Foo };
// @Filename: /main.ts
import { Foo } from "./exported";
export default Foo;
| {
"end_byte": 188,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportDefaultImportedType.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.