_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/compiler/ParameterList4.ts_0_24
function F(public A) { }
{ "end_byte": 24, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ParameterList4.ts" }
TypeScript/tests/cases/compiler/regularExpressionWithNonBMPFlags.ts_0_461
// @target: esnext // The characters in the following regular expression are ASCII-lookalike characters found in Unicode, including: // - 𝘴 (U+1D634 Mathematical Sans-Serif Italic Small S) // - 𝘪 (U+1D62A Mathematical Sans-Serif Italic Small I) // - 𝘮 (U+1D62E Mathematical Sans-Serif Italic Small M) // // See https...
{ "end_byte": 461, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/regularExpressionWithNonBMPFlags.ts" }
TypeScript/tests/cases/compiler/ambientFundule.ts_0_71
declare function f(); declare module f { var x } declare function f(x);
{ "end_byte": 71, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ambientFundule.ts" }
TypeScript/tests/cases/compiler/propTypeValidatorInference.ts_0_2943
// @strict: true // @filename: node_modules/prop-types/index.d.ts export const nominalTypeHack: unique symbol; export type IsOptional<T> = undefined | null extends T ? true : undefined extends T ? true : null extends T ? true : false; export type RequiredKeys<V> = { [K in keyof V]-?: Exclude<V[K], undefined> extends ...
{ "end_byte": 2943, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propTypeValidatorInference.ts" }
TypeScript/tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts_1_737
interface Foo { foo: any } interface Bar { bar: any } interface Baz { baz: any } interface Kwah { kwah: any } //////// interface A<T> { aProp: T; } interface B<T> { bProp: T; } interface C<T> { cProp: T; } declare const a: A<Foo>; declare const b: B<Foo>; declare const c: C<Foo>; declare let thingOfInt...
{ "end_byte": 737, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts" }
TypeScript/tests/cases/compiler/excessPropertyCheckWithMultipleDiscriminants.ts_0_2823
// Repro from #32657 interface Base<T> { value: T; } interface Int extends Base<number> { type: "integer"; multipleOf?: number; } interface Float extends Base<number> { type: "number"; } interface Str extends Base<string> { type: "string"; format?: string; } interface Bool extends Base<bool...
{ "end_byte": 2823, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/excessPropertyCheckWithMultipleDiscriminants.ts" }
TypeScript/tests/cases/compiler/declarationFileOverwriteError.ts_0_96
// @declaration: true // @Filename: a.d.ts declare class c { } // @FileName: a.ts class d { }
{ "end_byte": 96, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationFileOverwriteError.ts" }
TypeScript/tests/cases/compiler/optionalParameterProperty.ts_0_139
// @strictNullChecks: true class C { p: number; } class D extends C { constructor(public p?: number) { super(); } }
{ "end_byte": 139, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/optionalParameterProperty.ts" }
TypeScript/tests/cases/compiler/visibilityOfCrossModuleTypeUsage.ts_0_823
// @module: commonjs //visibilityOfCrossModuleTypeUsage // @Filename: visibilityOfCrossModuleTypeUsage_commands.ts import fs = require('./visibilityOfCrossModuleTypeUsage_fs'); import server = require('./visibilityOfCrossModuleTypeUsage_server'); export interface IConfiguration { workspace: server.IWorkspace; ...
{ "end_byte": 823, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/visibilityOfCrossModuleTypeUsage.ts" }
TypeScript/tests/cases/compiler/elaboratedErrors.ts_0_465
interface FileSystem { read: number; } function fn(s: WorkerFS): void; function fn(s: FileSystem): void; function fn(s: FileSystem|WorkerFS) { } // This should issue a large error, not a small one class WorkerFS implements FileSystem { read: string; } interface Alpha { x: string; } interface Beta { y: number; } ...
{ "end_byte": 465, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/elaboratedErrors.ts" }
TypeScript/tests/cases/compiler/anyMappedTypesError.ts_0_51
// @noImplicitAny: true type Foo = {[P in "bar"]};
{ "end_byte": 51, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/anyMappedTypesError.ts" }
TypeScript/tests/cases/compiler/declarationEmitMappedTypeTemplateTypeofSymbol.ts_0_404
// @strict: true // @declaration: true // @filename: a.d.ts export declare const timestampSymbol: unique symbol; export declare const Timestamp: { [TKey in typeof timestampSymbol]: true; }; export declare function now(): typeof Timestamp; // @filename: b.ts import * as x from "./a"; export const timestamp = x.no...
{ "end_byte": 404, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitMappedTypeTemplateTypeofSymbol.ts" }
TypeScript/tests/cases/compiler/complexRecursiveCollections.ts_0_1288
// @skipLibCheck: true // @lib: es6 // @Filename: complex.ts interface Ara<T> { t: T } interface Collection<K, V> { map<M>(mapper: (value: V, key: K, iter: this) => M): Collection<K, M>; flatMap<M>(mapper: (value: V, key: K, iter: this) => Ara<M>, context?: any): Collection<K, M>; // these seem necessary to...
{ "end_byte": 1288, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexRecursiveCollections.ts" }
TypeScript/tests/cases/compiler/complexRecursiveCollections.ts_1289_7898
declare module Immutable { export function fromJS(jsValue: any, reviver?: (key: string | number, sequence: Collection.Keyed<string, any> | Collection.Indexed<any>, path?: Array<string | number>) => any): any; export function is(first: any, second: any): boolean; export function hash(value: any): number; export ...
{ "end_byte": 7898, "start_byte": 1289, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexRecursiveCollections.ts" }
TypeScript/tests/cases/compiler/complexRecursiveCollections.ts_7901_13301
export interface OrderedMap<K, V> extends Map<K, V> { // Sequence algorithms concat<KC, VC>(...collections: Array<Iterable<[KC, VC]>>): OrderedMap<K | KC, V | VC>; concat<C>(...collections: Array<{[key: string]: C}>): OrderedMap<K | string, V | C>; map<M>(mapper: (value: V, key: K, iter: this) => M, con...
{ "end_byte": 13301, "start_byte": 7901, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexRecursiveCollections.ts" }
TypeScript/tests/cases/compiler/complexRecursiveCollections.ts_13304_19924
export module Record { export function isRecord(maybeRecord: any): maybeRecord is Record.Instance<any>; export function getDescriptiveName(record: Instance<any>): string; export interface Class<T extends Object> { (values?: Partial<T> | Iterable<[string, any]>): Instance<T> & Readonly<T>; new (v...
{ "end_byte": 19924, "start_byte": 13304, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexRecursiveCollections.ts" }
TypeScript/tests/cases/compiler/complexRecursiveCollections.ts_19927_24757
export module Collection { function isKeyed(maybeKeyed: any): maybeKeyed is Collection.Keyed<any, any>; function isIndexed(maybeIndexed: any): maybeIndexed is Collection.Indexed<any>; function isAssociative(maybeAssociative: any): maybeAssociative is Collection.Keyed<any, any> | Collection.Indexed<any>; ...
{ "end_byte": 24757, "start_byte": 19927, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexRecursiveCollections.ts" }
TypeScript/tests/cases/compiler/complexRecursiveCollections.ts_24760_30152
export interface Collection<K, V> extends ValueObject { // Value equality equals(other: any): boolean; hashCode(): number; // Reading values get<NSV>(key: K, notSetValue: NSV): V | NSV; get(key: K): V | undefined; has(key: K): boolean; includes(value: V): boolean; contains(value: V):...
{ "end_byte": 30152, "start_byte": 24760, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexRecursiveCollections.ts" }
TypeScript/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts_3_178
@lib: es2015.core // @target: es5 // Error missing basic JavaScript objects function f(x: number, y: number, z: number) { return Array.from(arguments); } f(1, 2, 3);
{ "end_byte": 178, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts" }
TypeScript/tests/cases/compiler/classExpressionTest2.ts_0_203
function M() { var m = class C<X> { f<T>() { var t: T; var x: X; return { t, x }; } } var v = new m<number>(); return v.f<string>(); }
{ "end_byte": 203, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExpressionTest2.ts" }
TypeScript/tests/cases/compiler/commaOperatorLeftSideUnused.ts_0_1008
// @allowUnreachableCode: false var xx: any; var yy: any; function fn() { let arr: any[] = []; switch(arr.length) { // Should error case 0, 1: return 'zero or one'; default: return 'more than one'; } } // Should error let x = Math.pow((3, 5), 2); // Should error let a = [(3 + 4), ((1 + ...
{ "end_byte": 1008, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commaOperatorLeftSideUnused.ts" }
TypeScript/tests/cases/compiler/deduplicateImportsInSystem.ts_0_186
// @module: system import {A} from "f1"; import {B} from "f2"; import {C} from "f3"; import {D} from 'f2'; import {E} from "f2"; import {F} from 'f1'; console.log(A + B + C + D + E + F)
{ "end_byte": 186, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deduplicateImportsInSystem.ts" }
TypeScript/tests/cases/compiler/es5-asyncFunctionPropertyAccess.ts_0_270
// @lib: es5,es2015.promise // @noEmitHelpers: true // @target: ES5 declare var x, y, z, a, b, c; async function propertyAccess0() { y = await x.a; } async function propertyAccess1() { y = (await x).a; } async function callExpression0() { await x(y, z); }
{ "end_byte": 270, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5-asyncFunctionPropertyAccess.ts" }
TypeScript/tests/cases/compiler/jsxAttributeMissingInitializer.tsx_0_60
// @jsx: preserve const x = <div foo= ></div>; const y = 0;
{ "end_byte": 60, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxAttributeMissingInitializer.tsx" }
TypeScript/tests/cases/compiler/classExpressionNames.ts_0_290
// @noEmit: true // @noImplicitAny: true // @allowJs: true // @checkJs: true // @Filename: ts.ts var o = { C: class { } } var oc = new o.C() var V = class { } var v = new V() var A; A = class { } var a = new A() const { B = class { } } = ({ B: undefined }); var b = new B();
{ "end_byte": 290, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classExpressionNames.ts" }
TypeScript/tests/cases/compiler/noCrashWithVerbatimModuleSyntaxAndImportsNotUsedAsValues.ts_0_208
// @verbatimModuleSyntax: true // @importsNotUsedAsValues: error // @ignoreDeprecations: 5.0 // @filename: file.ts export class A {} // @filename: index.ts import {A} from "./file"; const a: A = null as any;
{ "end_byte": 208, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noCrashWithVerbatimModuleSyntaxAndImportsNotUsedAsValues.ts" }
TypeScript/tests/cases/compiler/allowSyntheticDefaultImports7.ts_0_166
// @module: system // @Filename: b.d.ts export function foo(); export function bar(); // @Filename: a.ts import { default as Foo } from "./b"; Foo.bar(); Foo.foo();
{ "end_byte": 166, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/allowSyntheticDefaultImports7.ts" }
TypeScript/tests/cases/compiler/typeReferenceDirectiveWithFailedFromTypeRoot.ts_0_406
// @noImplicitReferences: true // @typeRoots: /typings // @types: phaser // @traceResolution: true // @currentDirectory: / // @Filename: /typings/dummy.d.ts declare const a2: number; // @Filename: /node_modules/phaser/types/phaser.d.ts declare const a: number; // @Filename: /node_modules/phaser/package.json { "name"...
{ "end_byte": 406, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeReferenceDirectiveWithFailedFromTypeRoot.ts" }
TypeScript/tests/cases/compiler/outModuleConcatSystem.ts_0_215
// @target: ES5 // @sourcemap: true // @declaration: true // @module: system // @outFile: all.js // @Filename: ref/a.ts export class A { } // @Filename: b.ts import {A} from "./ref/a"; export class B extends A { }
{ "end_byte": 215, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/outModuleConcatSystem.ts" }
TypeScript/tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts_0_356
type Constructor = new (...args: any[]) => {}; const Mixin1 = <C extends Constructor>(Base: C) => class extends Base { private _fooPrivate: {}; } type FooConstructor = typeof Mixin1 extends (a: Constructor) => infer Cls ? Cls : never; const Mixin2 = <C extends FooConstructor>(Base: C) => class extends Base {}; class...
{ "end_byte": 356, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts" }
TypeScript/tests/cases/compiler/typeInferenceWithExcessPropertiesJsx.tsx_0_620
// @strict: true // @noEmit: true // @jsx: preserve /// <reference path="/.lib/react16.d.ts" /> import React = require('react'); type TranslationEntry = { args: [] | [unknown]; } type Translations = { a: { args: [string] }, b: { args: [] } } type TProps<Entry extends TranslationEntry> = { getTranslat...
{ "end_byte": 620, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeInferenceWithExcessPropertiesJsx.tsx" }
TypeScript/tests/cases/compiler/declarationMapsWithSourceMap.ts_0_329
// @declaration: true // @declarationMap: true // @outFile: bundle.js // @sourceMap: true // @filename: a.ts class Foo { doThing(x: {a: number}) { return {b: x.a}; } static make() { return new Foo(); } } // @filename: index.ts const c = new Foo(); c.doThing({a: 42}); let x = c.doThing({...
{ "end_byte": 329, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationMapsWithSourceMap.ts" }
TypeScript/tests/cases/compiler/parenthesizedSatisfiesExpressionWithComments.ts_0_125
"use strict"; // @removeComments: false const a = (/*comm*/ 10 satisfies number); const b = ((/*comm*/ 10 satisfies number));
{ "end_byte": 125, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parenthesizedSatisfiesExpressionWithComments.ts" }
TypeScript/tests/cases/compiler/numericIndexerTyping1.ts_0_266
interface I { [x: string]: Date; } interface I2 extends I { } var i: I; var r: string = i[1]; // error: numeric indexer returns the type of the string indexer var i2: I2; var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexer
{ "end_byte": 266, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/numericIndexerTyping1.ts" }
TypeScript/tests/cases/compiler/tryCatchFinally.ts_0_72
try { } catch(e) { } finally { } try {} catch(e) {} try {} finally {}
{ "end_byte": 72, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/tryCatchFinally.ts" }
TypeScript/tests/cases/compiler/declarationEmitCrossFileCopiedGeneratedImportType.ts_0_410
// @declaration: true // @filename: projA/index.d.ts export declare class Foo extends Number { private _; } // @filename: projB/index.d.ts import { Foo } from "../projA"; export declare const f: (foo: Foo) => boolean; // @filename: projC/index.d.ts export declare const e: { f: (foo: import("../projA").Foo) => b...
{ "end_byte": 410, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitCrossFileCopiedGeneratedImportType.ts" }
TypeScript/tests/cases/compiler/es6-umd2.ts_0_174
// @target: ES6 // @sourcemap: false // @declaration: false // @module: umd export class A { constructor () { } public B() { return 42; } }
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6-umd2.ts" }
TypeScript/tests/cases/compiler/moduleResolutionWithSuffixes_empty.ts_0_308
// moduleSuffixes is empty. Normal module resolution should occur. // @filename: /tsconfig.json { "compilerOptions": { "moduleResolution": "node", "traceResolution": true, "moduleSuffixes": [] } } // @filename: /index.ts import { base } from "./foo"; // @filename: /foo.ts export function base() {}
{ "end_byte": 308, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionWithSuffixes_empty.ts" }
TypeScript/tests/cases/compiler/this_inside-enum-should-not-be-allowed.ts_0_220
enum TopLevelEnum { ThisWasAllowedButShouldNotBe = this // Should not be allowed } module ModuleEnum { enum EnumInModule { WasADifferentError = this // this was handled as if this was in a module } }
{ "end_byte": 220, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/this_inside-enum-should-not-be-allowed.ts" }
TypeScript/tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesDeepNonrelativeName.ts_0_1207
// @declaration: true // @module: nodenext // @filename: workspace/packageA/foo.d.ts export declare class Foo { private f: any; } // @filename: workspace/packageA/index.d.ts import { Foo } from "./foo.js"; export function create(): Foo; // @filename: workspace/packageA/package.json { "name": "package-a", "v...
{ "end_byte": 1207, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/symlinkedWorkspaceDependenciesNoDirectLinkGeneratesDeepNonrelativeName.ts" }
TypeScript/tests/cases/compiler/contextualTypingArrayDestructuringWithDefaults.ts_0_257
type I = { a: "a" }; let [ c0 = {a: "a"} ]: [I?] = []; let [ x1, c1 = {a: "a"} ]: [number, I?] = [1]; let [ c_ = {a: "a"} ]: I[] = []; // not a great example, expect an error function foo() { let {length = {a: 1}}: [number] = [1]; return length; }
{ "end_byte": 257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTypingArrayDestructuringWithDefaults.ts" }
TypeScript/tests/cases/compiler/thisInConstructorParameter2.ts_0_225
class P { x = this; static y = this; constructor(public z = this, zz = this, zzz = (p = this) => this) { zzz = (p = this) => this; } foo(zz = this) { zz.x; } static bar(zz = this) { zz.y; } }
{ "end_byte": 225, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInConstructorParameter2.ts" }
TypeScript/tests/cases/compiler/genericSignatureInheritance2.ts_0_89
interface I { <T>(x: T): string; } interface I2 extends I { <T>(x: T): void; }
{ "end_byte": 89, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericSignatureInheritance2.ts" }
TypeScript/tests/cases/compiler/nestedBlockScopedBindings9.ts_0_102
{ let x; () => x; } switch (1) { case 1: let y; () => y; break; }
{ "end_byte": 102, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedBlockScopedBindings9.ts" }
TypeScript/tests/cases/compiler/noCollisionThisExpressionAndClassInGlobal.ts_0_36
class _this { } var f = () => _this;
{ "end_byte": 36, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noCollisionThisExpressionAndClassInGlobal.ts" }
TypeScript/tests/cases/compiler/signatureLengthMismatchCall.ts_0_107
function takesCallback(fn: (a: number) => void) { // ... } takesCallback((a: number, b: number) => {});
{ "end_byte": 107, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/signatureLengthMismatchCall.ts" }
TypeScript/tests/cases/compiler/assign1.ts_0_113
module M { interface I { salt:number; pepper:number; } var x:I={salt:2,pepper:0}; }
{ "end_byte": 113, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assign1.ts" }
TypeScript/tests/cases/compiler/identifierStartAfterNumericLiteral.ts_0_189
let valueIn = 3in[null]; 3a[null] 123a[null] 3e[null] 123e[null] 3in[null] 123in[null] 3en[null] 123en[null] 1a 123a 123abc 1e 123e 1e9 123e9 1ee 123ee 1n 123n 2n2 123n2 2na 123na 123nabc
{ "end_byte": 189, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/identifierStartAfterNumericLiteral.ts" }
TypeScript/tests/cases/compiler/importHelpersInTsx.tsx_0_916
// @importHelpers: true // @target: es5 // @module: commonjs // @moduleResolution: classic // @jsx: react // @experimentalDecorators: true // @emitDecoratorMetadata: true // @filename: external.tsx declare var React: any; declare var o: any; export const x = <span {...o} /> // @filename: script.tsx declare var React: ...
{ "end_byte": 916, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersInTsx.tsx" }
TypeScript/tests/cases/compiler/moduleExportNonStructured.ts_0_807
// @target: ESNext // @module: ESNext // @moduleResolution: NodeNext // @strict: true // @filename: package.json { "name": "test", "version": "1.0.0", "description": "", "type": "module", "module": "index.mjs" } // @filename: index.mts import * as exportAny from "./exportAny.cjs"; import * as expo...
{ "end_byte": 807, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleExportNonStructured.ts" }
TypeScript/tests/cases/compiler/parseArrowFunctionWithFunctionReturnType.ts_0_44
const fn = <T>(): (() => T) => null as any;
{ "end_byte": 44, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseArrowFunctionWithFunctionReturnType.ts" }
TypeScript/tests/cases/compiler/declarationsForIndirectTypeAliasReference.ts_0_478
// @declaration: true // @filename: b.ts export { Hash, StringHash, StringHash2 }; interface Hash<T> { [key: string]: T; } type StringHash = Hash<string>; interface StringHash2 extends Hash<string> {} // @filename: a.ts import {StringHash, StringHash2} from "./b"; export { doSome } const MAP: Strin...
{ "end_byte": 478, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationsForIndirectTypeAliasReference.ts" }
TypeScript/tests/cases/compiler/generatorReturnExpressionIsChecked.ts_0_92
// @lib: esnext // @target: esnext function* f(): Iterator<number> { return invalid; }
{ "end_byte": 92, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/generatorReturnExpressionIsChecked.ts" }
TypeScript/tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts_0_790
// @lib: es5 1..toString(); 1.0.toString(); 1.toString(); 1.+2.0 + 3. ; // Preserve whitespace and comments where important for JS compatibility var i: number = 1; var test1 = i.toString(); var test2 = 2.toString(); var test3 = 3 .toString(); var test4 = 3 .toString(); var test5 = 3 .toString(); var test6 = 3.['toS...
{ "end_byte": 790, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts" }
TypeScript/tests/cases/compiler/compositeContextualSignature.ts_0_254
// @strict: true // @noEmit: true // Repro from #55145 function f<T extends any[]>(v: ReadonlyArray<T>) { } f([ [ undefined, () => { }, ], [ 1, () => { console.log('Hello') }, ], ]);
{ "end_byte": 254, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/compositeContextualSignature.ts" }
TypeScript/tests/cases/compiler/generativeRecursionWithTypeOf.ts_0_156
class C<T> { static foo(x: number) { } type: T; } module M { export function f(x: typeof C) { return new x<typeof x>(); } }
{ "end_byte": 156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/generativeRecursionWithTypeOf.ts" }
TypeScript/tests/cases/compiler/recursiveExcessPropertyChecks.ts_0_228
// @strict: true // Repro from #35804 interface ITreeItem { Parent?: this; } type NodeWithId = ITreeItem & { Id?: number }; function getMaxId(items: NodeWithId[]) { } const nodes = [] as ITreeItem[]; getMaxId(nodes);
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveExcessPropertyChecks.ts" }
TypeScript/tests/cases/compiler/typeArgumentInferenceWithRecursivelyReferencedTypeAliasToTypeLiteral02.ts_0_187
type TreeNode = { name: string; parent: TreeNode; } type TreeNodeMiddleman = { name: string; parent: TreeNode; } var nodes: TreeNodeMiddleman[]; nodes.map(n => n.name);
{ "end_byte": 187, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeArgumentInferenceWithRecursivelyReferencedTypeAliasToTypeLiteral02.ts" }
TypeScript/tests/cases/compiler/commentOnArrayElement15.ts_3_50
nst array = [/* comment */ 1 /* comment */];
{ "end_byte": 50, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentOnArrayElement15.ts" }
TypeScript/tests/cases/compiler/javascriptDefinePropertyPrototypeNonConstructor.ts_0_200
// @allowJs: true // @checkJs: false // @noEmit: true // @Filename: /a.js function Graphic() { } Object.defineProperty(Graphic.prototype, "instance", { get: function() { return this; } });
{ "end_byte": 200, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/javascriptDefinePropertyPrototypeNonConstructor.ts" }
TypeScript/tests/cases/compiler/parseEntityNameWithReservedWord.ts_0_54
enum Bool { false } const x: Bool.false = Bool.false;
{ "end_byte": 54, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseEntityNameWithReservedWord.ts" }
TypeScript/tests/cases/compiler/contextualTyping27.ts_0_60
function foo(param:{id:number;}){}; foo(<{id:number;}>({}));
{ "end_byte": 60, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTyping27.ts" }
TypeScript/tests/cases/compiler/genericInferenceDefaultTypeParameter.ts_0_249
// @strict: true // Repro from #50858 type Type = { a: (e: string) => void; b: (e: number) => void; } declare function f1<T extends keyof Type = "a">(props: Type[T]): void; f1(event => { }); f1<"a">(event => { }); f1<"b">(event => { });
{ "end_byte": 249, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericInferenceDefaultTypeParameter.ts" }
TypeScript/tests/cases/compiler/asiAbstract.ts_0_140
abstract class NonAbstractClass { abstract s(); } class C2 { abstract nonAbstractFunction() { } } class C3 { abstract }
{ "end_byte": 140, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/asiAbstract.ts" }
TypeScript/tests/cases/compiler/genericClasses4.ts_0_464
// once caused stack overflow class Vec2_T<A> { constructor(public x: A, public y: A) { } fmap<B>(f: (a: A) => B): Vec2_T<B> { var x:B = f(this.x); var y:B = f(this.y); var retval: Vec2_T<B> = new Vec2_T(x, y); return retval; } apply<B>(f: Vec2_T<(a: A) => B>): Vec2_T<B> ...
{ "end_byte": 464, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericClasses4.ts" }
TypeScript/tests/cases/compiler/moduleMemberWithoutTypeAnnotation1.ts_3_1203
dule TypeScript.Parser { class SyntaxCursor { public currentNode(): SyntaxNode { return null; } } } module TypeScript { export interface ISyntaxElement { }; export interface ISyntaxToken { }; export class PositionedElement { public childIndex(child: ISyntaxEleme...
{ "end_byte": 1203, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleMemberWithoutTypeAnnotation1.ts" }
TypeScript/tests/cases/compiler/jsxFactoryQualifiedNameResolutionError.ts_0_308
//@jsx: react //@target: es6 //@module: commonjs //@jsxFactory: MyElement.createElement //@sourcemap: true // @filename: test.tsx declare module JSX { interface IntrinsicElements { [s: string]: any; } } export class AppComponent { render(createElement) { return <div />; } }
{ "end_byte": 308, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxFactoryQualifiedNameResolutionError.ts" }
TypeScript/tests/cases/compiler/breakNotInIterationOrSwitchStatement2.ts_0_48
while (true) { function f() { break; } }
{ "end_byte": 48, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/breakNotInIterationOrSwitchStatement2.ts" }
TypeScript/tests/cases/compiler/commentsExternalModules3.ts_0_1348
// @module: commonjs // @target: ES5 // @declaration: true // @removeComments: false // @Filename: commentsExternalModules2_0.ts /** Module comment*/ export module m1 { /** b's comment*/ export var b: number; /** foo's comment*/ function foo() { return b; } /** m2 comments*/ export ...
{ "end_byte": 1348, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsExternalModules3.ts" }
TypeScript/tests/cases/compiler/selfReferencingFile.ts_0_77
///<reference path='selfReferencingFile.ts'/> class selfReferencingFile { }
{ "end_byte": 77, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/selfReferencingFile.ts" }
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.ts_0_473
// @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 } from "/foo"; import { bar } from "/bar"; // @filename: /root/tsconfig.json { "compile...
{ "end_byte": 473, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.ts" }
TypeScript/tests/cases/compiler/typeVal.ts_0_58
interface I { I:number; } var I:I = { I: 3}; I.I=4;
{ "end_byte": 58, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeVal.ts" }
TypeScript/tests/cases/compiler/commentOnAmbientClass1.ts_0_260
//@filename: a.ts /*!========= Keep this pinned comment ========= */ /*! Don't keep this pinned comment */ declare class C { } // Don't keep this comment. declare class D { } //@filename: b.ts ///<reference path="a.ts"/> declare class E extends C { }
{ "end_byte": 260, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentOnAmbientClass1.ts" }
TypeScript/tests/cases/compiler/noUnusedLocals_writeOnlyProperty_dynamicNames.ts_0_215
// @noUnusedLocals: true // @lib: es6 const x = Symbol("x"); const y = Symbol("y"); class C { private [x]: number; private [y]: number; m() { this[x] = 0; // write-only this[y]; } }
{ "end_byte": 215, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noUnusedLocals_writeOnlyProperty_dynamicNames.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationGlobal7_1.ts_0_67
namespace A { global { interface Array<T> { x } } }
{ "end_byte": 67, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationGlobal7_1.ts" }
TypeScript/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.ts_0_354
// @outDir: testfiles // @sourcemap: true // @useCaseSensitiveFileNames: false // @Filename: testFiles/app.ts // Note in the out result we are using same folder name only different in casing // Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap class c { } // @Filen...
{ "end_byte": 354, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.ts" }
TypeScript/tests/cases/compiler/exportEqualsOfModule.ts_0_450
declare module '~popsicle/dist/request' { export class Request {} } declare module '~popsicle/dist/common' { import { Request } from '~popsicle/dist/request'; export { Request }; } declare module 'popsicle' { import alias = require('~popsicle/dist/common'); export = alias; } declare module 'popsi...
{ "end_byte": 450, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportEqualsOfModule.ts" }
TypeScript/tests/cases/compiler/privacyGloClass.ts_0_1272
module m1 { export interface m1_i_public { } interface m1_i_private { } export class m1_c_public { private f1() { } } class m1_c_private { } class m1_C1_private extends m1_c_public { } class m1_C2_private extends m1_c_private { } export class m1_C3...
{ "end_byte": 1272, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyGloClass.ts" }
TypeScript/tests/cases/compiler/enumMemberReduction.ts_0_712
enum MyEnum { A, B, C, } enum MyStringEnum { A = "a", B = "b", C = "c", } enum MyStringEnumWithEmpty { A = "", B = "b", C = "c", } export function fn(optionalEnum: MyEnum | undefined) { return optionalEnum ?? MyEnum.A; } export function fn2(optionalEnum: MyEnum | undefined) { return optionalEn...
{ "end_byte": 712, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumMemberReduction.ts" }
TypeScript/tests/cases/compiler/reexportNameAliasedAndHoisted.ts_0_295
// @filename: gridview.ts export type Sizing = any; export const Sizing = null; // @filename: index.ts // https://github.com/microsoft/TypeScript/issues/39195 export { Sizing as GridViewSizing } from './gridview'; export namespace Sizing { export const Distribute = { type: 'distribute' }; }
{ "end_byte": 295, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reexportNameAliasedAndHoisted.ts" }
TypeScript/tests/cases/compiler/typeParameterArgumentEquivalence2.ts_0_158
function foo<T,U>() { var x: (item: U) => boolean; var y: (item: T) => boolean; x = y; // Should be an error y = x; // Shound be an error }
{ "end_byte": 158, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParameterArgumentEquivalence2.ts" }
TypeScript/tests/cases/compiler/privacyClassImplementsClauseDeclFile.ts_0_3483
// @module: commonjs // @declaration: true // @Filename: privacyClassImplementsClauseDeclFile_externalModule.ts export module publicModule { export interface publicInterfaceInPublicModule { } interface privateInterfaceInPublicModule { } class privateClassImplementingPublicInterfaceInModule implem...
{ "end_byte": 3483, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyClassImplementsClauseDeclFile.ts" }
TypeScript/tests/cases/compiler/duplicatePackage_relativeImportWithinPackage.ts_0_721
// @noImplicitReferences: true // @traceResolution: true // @Filename: /node_modules/a/node_modules/foo/package.json { "name": "foo", "version": "1.2.3" } // @Filename: /node_modules/a/node_modules/foo/index.d.ts export class C { private x: number; } // @Filename: /node_modules/a/index.d.ts import { C } ...
{ "end_byte": 721, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/duplicatePackage_relativeImportWithinPackage.ts" }
TypeScript/tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts_3_134
@target: es5 function f(x: TemplateStringsArray, y: number, z: number) { } f({}, 10, 10); f `abcdef${ 1234 }${ 5678 }ghijkl`;
{ "end_byte": 134, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts" }
TypeScript/tests/cases/compiler/invalidContinueInDownlevelAsync.ts_0_99
async function func() { if (true) { continue; } else { await 1; } }
{ "end_byte": 99, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/invalidContinueInDownlevelAsync.ts" }
TypeScript/tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx_0_446
// @jsx: react // @esModuleInterop: true /// <reference path="/.lib/react16.d.ts" /> import React, { ReactElement } from "react"; declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement<any>; declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement<any>; cons...
{ "end_byte": 446, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx" }
TypeScript/tests/cases/compiler/awaitInNonAsyncFunction.ts_0_776
// @target: esnext // https://github.com/Microsoft/TypeScript/issues/26586 function normalFunc(p: Promise<number>) { for await (const _ of []); return await p; } export function exportedFunc(p: Promise<number>) { for await (const _ of []); return await p; } const functionExpression = function(p: Promise<numb...
{ "end_byte": 776, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/awaitInNonAsyncFunction.ts" }
TypeScript/tests/cases/compiler/fatArrowfunctionAsType.ts_0_105
declare var b: <T>(x: T) => void ; var c: <T>(x: T) => void = function <T>(x: T) { return 42; } b = c;
{ "end_byte": 105, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/fatArrowfunctionAsType.ts" }
TypeScript/tests/cases/compiler/functionAssignment.ts_0_553
function f(n: Function) { } f(function () { }); interface foo { get(handler: (bar: number)=>void): void; } interface baz { get(callback: Function): number; } var barbaz: baz; var test: foo; test.get(function (param) { var x = barbaz.get(function () { }); }); function f2(n: () => void) { } f2(() => { ...
{ "end_byte": 553, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionAssignment.ts" }
TypeScript/tests/cases/compiler/noImplicitAnyInCastExpression.ts_3_343
@noImplicitAny: true // verify no noImplictAny errors reported with cast expression interface IFoo { a: number; b: string; } // Expr type not assignable to target type (<IFoo>{ a: null }); // Expr type assignable to target type (<IFoo>{ a: 2, b: undefined }); // Neither types is assignable to each other (<...
{ "end_byte": 343, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noImplicitAnyInCastExpression.ts" }
TypeScript/tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts_0_372
class Chain<T extends A> { constructor(public value: T) { } then<S extends T>(cb: (x: T) => S): Chain<S> { return null; } } class A { x; } class B extends A { y; } class C extends B { z; } // Ok to go down the chain, but error to try to climb back up (new Chain(new A)).then(a => new B)...
{ "end_byte": 372, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts" }
TypeScript/tests/cases/compiler/moduleMergeConstructor.ts_0_398
// @module: amd // @filename: foo.d.ts declare module "foo" { export class Foo { constructor(); method1(): any; } } // @filename: foo-ext.d.ts declare module "foo" { export interface Foo { method2(): any; } } // @filename: index.ts import * as foo from "foo"; class Test { ...
{ "end_byte": 398, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleMergeConstructor.ts" }
TypeScript/tests/cases/compiler/excessPropertyErrorsSuppressed.ts_3_101
@suppressExcessPropertyErrors: true var x: { a: string } = { a: "hello", b: 42 }; // No error
{ "end_byte": 101, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/excessPropertyErrorsSuppressed.ts" }
TypeScript/tests/cases/compiler/exportStarForValues.ts_0_119
// @module: amd // @filename: file1.ts export interface Foo { x } // @filename: file2.ts export * from "file1" var x;
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportStarForValues.ts" }
TypeScript/tests/cases/compiler/varArgConstructorMemberParameter.ts_0_178
class Foo1 { constructor (...args: string[]) { } } class Foo2 { constructor (public args: string[]) { } } class Foo3 { constructor (public ...args: string[]) { } }
{ "end_byte": 178, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/varArgConstructorMemberParameter.ts" }
TypeScript/tests/cases/compiler/invocationExpressionInFunctionParameter.ts_0_97
function foo1(val: string) { } function foo3(x = foo1(123)) { //should error, 123 is not string }
{ "end_byte": 97, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/invocationExpressionInFunctionParameter.ts" }
TypeScript/tests/cases/compiler/superPropertyAccessInSuperCall01.ts_0_143
class A { constructor(f: string) { } public blah(): string { return ""; } } class B extends A { constructor() { super(super.blah()) } }
{ "end_byte": 143, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superPropertyAccessInSuperCall01.ts" }
TypeScript/tests/cases/compiler/enumMapBackIntoItself.ts_0_209
enum TShirtSize { Small, Medium, Large } var mySize = TShirtSize.Large; var test = TShirtSize[mySize]; // specifically checking output here, bug was that test used to be undefined at runtime test + ''
{ "end_byte": 209, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumMapBackIntoItself.ts" }
TypeScript/tests/cases/compiler/commentOnAmbientModule.ts_0_345
//@filename: a.ts /*!========= Keep this pinned comment ========= */ /*! Don't keep this pinned comment */ declare module C { function foo(); } // Don't keep this comment. declare module D { class bar { } } //@filename: b.ts ///<reference path="a.ts"/> declare module E { class foobar extends D.bar...
{ "end_byte": 345, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentOnAmbientModule.ts" }
TypeScript/tests/cases/compiler/moduleLocalImportNotIncorrectlyRedirected.ts_0_610
// @noImplicitReferences: true // @filename: node_modules/troublesome-lib/package.json { "name": "troublesome-lib", "typings": "lib/index.d.ts", "version": "0.0.1" } // @filename: node_modules/troublesome-lib/lib/index.d.ts import { Position } from './utilities/positioning'; export interface ISpinButton {} // @filename...
{ "end_byte": 610, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleLocalImportNotIncorrectlyRedirected.ts" }