_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/compiler/resolveNameWithNamspace.ts_0_459
// @module: commonjs // @allowJs: true // @outDir: ./out/ // @filename: node.d.ts declare function require(moduleName: string): any; declare module "assert" { export function equal(actual: any, expected: any, message?: string | Error): void; } // @filename: ns.ts /// <reference path="node.d.ts"/> namespace myAssert { export type cool = 'cool' } var myAssert = require('assert') // @filename: app.js exports.equal = myAssert.equal exports.equal()
{ "end_byte": 459, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/resolveNameWithNamspace.ts" }
TypeScript/tests/cases/compiler/declarationEmitUsingTypeAlias1.ts_0_674
// @strict: true // @declaration: true // @module: nodenext // @filename: node_modules/some-dep/dist/inner.d.ts export declare type Other = { other: string }; export declare type SomeType = { arg: Other }; // @filename: node_modules/some-dep/dist/index.d.ts export type OtherType = import('./inner').Other; export type SomeType = import('./inner').SomeType; // @filename: node_modules/some-dep/package.json { "name": "some-dep", "exports": { ".": "./dist/index.js" } } // @filename: src/index.ts import { SomeType } from "some-dep"; export const foo = (thing: SomeType) => { return thing; }; export const bar = (thing: SomeType) => { return thing.arg; };
{ "end_byte": 674, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitUsingTypeAlias1.ts" }
TypeScript/tests/cases/compiler/superCallFromClassThatHasNoBaseType1.ts_1_143
class A { constructor(private map: (value: number) => string) { } } class B { constructor() { super(value => String(value)); } }
{ "end_byte": 143, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superCallFromClassThatHasNoBaseType1.ts" }
TypeScript/tests/cases/compiler/classSideInheritance3.ts_0_327
class A { constructor(public x: string) { } } class B extends A { constructor(x: string, public data: string) { super(x); } } class C extends A { constructor(x: string) { super(x); } } var r1: typeof A = B; // error var r2: new (x: string) => A = B; // error var r3: typeof A = C; // ok
{ "end_byte": 327, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/classSideInheritance3.ts" }
TypeScript/tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement2.ts_0_298
// @strict: true // @lib: esnext // @target: esnext // @removeComments: false export class Foo { client = { getThing: () => Promise.resolve('') } foo() { return ( /* TODO: please refactor */ this.client .getThing() satisfies Promise<string>); } }
{ "end_byte": 298, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement2.ts" }
TypeScript/tests/cases/compiler/recursiveComplicatedClasses.ts_0_391
class Signature { public parameters: ParameterSymbol[] = null; } function aEnclosesB(a: Symbol) { return true; } class Symbol { public bound: boolean; public visible() { var b: TypeSymbol; return aEnclosesB(b); } } class InferenceSymbol extends Symbol { } class ParameterSymbol extends InferenceSymbol { } class TypeSymbol extends InferenceSymbol { }
{ "end_byte": 391, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveComplicatedClasses.ts" }
TypeScript/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction2.ts_0_299
class TestFile { name: string; foo(message: string): () => string { return (...x: string[]) => /// <summary>Test summary</summary> /// <param name="message" type="String" /> /// <returns type="Function" /> message + this.name; } }
{ "end_byte": 299, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction2.ts" }
TypeScript/tests/cases/compiler/stradac.ts_3_105
r x = 10; // C++-style comment /* C-Style comment */ function foo() { x++; }
{ "end_byte": 105, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/stradac.ts" }
TypeScript/tests/cases/compiler/es5andes6module.ts_0_183
// @target: ES5 // @sourcemap: false // @declaration: false // @module: es6 export default class A { constructor () { } public B() { return 42; } }
{ "end_byte": 183, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es5andes6module.ts" }
TypeScript/tests/cases/compiler/typeCheckReturnExpression.ts_0_49
//@noImplicitAny: true var foo = () => undefined;
{ "end_byte": 49, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeCheckReturnExpression.ts" }
TypeScript/tests/cases/compiler/genericTupleWithSimplifiableElements.ts_0_452
// @strict: true // @noEmit: true // repro from #52354 type SS1 = string; let y: [t: "AAA", ...args: { [S in SS1]: [a: number]; }[SS1]] = ["AAA", 1]; type SS2 = "1" | "2" | "3"; let z: [t: "AAA", ...args: { [S in SS2]: [a: number]; }[SS2]] = ["AAA", 1]; class I<SS extends string>{ f() { let w: [...args: { [S in SS]: [a: number]; }[SS]] = [1]; let x: [t: "AAA", ...args: { [S in SS]: [a: number]; }[SS]] = ["AAA", 1]; } }
{ "end_byte": 452, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericTupleWithSimplifiableElements.ts" }
TypeScript/tests/cases/compiler/circularBaseConstraint.ts_0_260
// @strict: true // @noEmit: true // Repro from #54610 type A<T> = T; type B<T> = T extends any[] ? never : A<T> extends infer key ? key extends keyof T ? B<T[key]> : never : never; function foo<T>() { `${a}` as B<T>; }
{ "end_byte": 260, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/circularBaseConstraint.ts" }
TypeScript/tests/cases/compiler/anonymousClassExpression2.ts_0_397
// Fixes #14860 // note: repros with `while (0);` too // but it's less inscrutable and more obvious to put it *inside* the loop while (0) { class A { methodA() { this; //note: a this reference of some kind is required to trigger the bug } } class B { methodB() { this.methodA; // error this.methodB; // ok } } }
{ "end_byte": 397, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/anonymousClassExpression2.ts" }
TypeScript/tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts_0_359
//@module: amd export module m { export class c { } } import exports = m.c; import require = m.c; new exports(); new require(); module m1 { import exports = m.c; import require = m.c; new exports(); new require(); } module m2 { export import exports = m.c; export import require = m.c; new exports(); new require(); }
{ "end_byte": 359, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts" }
TypeScript/tests/cases/compiler/typeArgumentDefaultUsesConstraintOnCircularDefault.ts_0_275
type Test<T extends string = T> = { value: T }; // Error let zz: Test = { foo: "abc" }; // should error on comparison with Test<string> let zzy: Test = { value: {} }; // Simplified repro from #28873 class C1<T extends C1 = any> {} class C2<T extends C2<any> = any> {}
{ "end_byte": 275, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeArgumentDefaultUsesConstraintOnCircularDefault.ts" }
TypeScript/tests/cases/compiler/typeofClass.ts_0_114
class K { foo: number; static bar: string; } var k1: K; k1.foo; k1.bar; var k2: typeof K; k2.foo; k2.bar;
{ "end_byte": 114, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeofClass.ts" }
TypeScript/tests/cases/compiler/indexSignaturesInferentialTyping.ts_0_297
function foo<T>(items: { [index: number]: T }): T { return undefined; } function bar<T>(items: { [index: string]: T }): T { return undefined; } var x1 = foo({ 0: 0, 1: 1 }); // type should be number var x2 = bar({ 0: 0, 1: 1 }); var x3 = bar({ zero: 0, one: 1 }); // type should be number
{ "end_byte": 297, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexSignaturesInferentialTyping.ts" }
TypeScript/tests/cases/compiler/bindingPatternInParameter01.ts_0_104
const nestedArray = [[[1, 2]], [[3, 4]]]; nestedArray.forEach(([[a, b]]) => { console.log(a, b); });
{ "end_byte": 104, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/bindingPatternInParameter01.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationImportsAndExports5.ts_0_624
// @module: commonjs // @declaration: true // @filename: f1.ts export class A {} // @filename: f2.ts export class B { n: number; } // @filename: f3.ts import {A} from "./f1"; import {B} from "./f2"; A.prototype.foo = function () { return undefined; } namespace N { export interface Ifc { a: number; } export interface Cls { b: number; } } import I = N.Ifc; import C = N.Cls; declare module "./f1" { interface A { foo(): B; bar(): I; baz(): C; } } // @filename: f4.ts import {A} from "./f1"; import "./f3"; let a: A; let b = a.foo().n; let c = a.bar().a; let d = a.baz().b;
{ "end_byte": 624, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationImportsAndExports5.ts" }
TypeScript/tests/cases/compiler/privacyGetter.ts_0_4166
// @target: ES5 //@module: amd export module m1 { export class C1_public { private f1() { } } class C2_private { } export class C3_public { private get p1_private() { return new C1_public(); } private set p1_private(m1_c3_p1_arg: C1_public) { } private get p2_private() { return new C1_public(); } private set p2_private(m1_c3_p2_arg: C1_public) { } private get p3_private() { return new C2_private(); } private set p3_private(m1_c3_p3_arg: C2_private) { } public get p4_public(): C2_private { // error return new C2_private(); //error } public set p4_public(m1_c3_p4_arg: C2_private) { // error } } class C4_private { private get p1_private() { return new C1_public(); } private set p1_private(m1_c3_p1_arg: C1_public) { } private get p2_private() { return new C1_public(); } private set p2_private(m1_c3_p2_arg: C1_public) { } private get p3_private() { return new C2_private(); } private set p3_private(m1_c3_p3_arg: C2_private) { } public get p4_public(): C2_private { return new C2_private(); } public set p4_public(m1_c3_p4_arg: C2_private) { } } } module m2 { export class m2_C1_public { private f1() { } } class m2_C2_private { } export class m2_C3_public { private get p1_private() { return new m2_C1_public(); } private set p1_private(m2_c3_p1_arg: m2_C1_public) { } private get p2_private() { return new m2_C1_public(); } private set p2_private(m2_c3_p2_arg: m2_C1_public) { } private get p3_private() { return new m2_C2_private(); } private set p3_private(m2_c3_p3_arg: m2_C2_private) { } public get p4_public(): m2_C2_private { return new m2_C2_private(); } public set p4_public(m2_c3_p4_arg: m2_C2_private) { } } class m2_C4_private { private get p1_private() { return new m2_C1_public(); } private set p1_private(m2_c3_p1_arg: m2_C1_public) { } private get p2_private() { return new m2_C1_public(); } private set p2_private(m2_c3_p2_arg: m2_C1_public) { } private get p3_private() { return new m2_C2_private(); } private set p3_private(m2_c3_p3_arg: m2_C2_private) { } public get p4_public(): m2_C2_private { return new m2_C2_private(); } public set p4_public(m2_c3_p4_arg: m2_C2_private) { } } } class C5_private { private f() { } } export class C6_public { } export class C7_public { private get p1_private() { return new C6_public(); } private set p1_private(m1_c3_p1_arg: C6_public) { } private get p2_private() { return new C6_public(); } private set p2_private(m1_c3_p2_arg: C6_public) { } private get p3_private() { return new C5_private(); } private set p3_private(m1_c3_p3_arg: C5_private) { } public get p4_public(): C5_private { // error return new C5_private(); //error } public set p4_public(m1_c3_p4_arg: C5_private) { // error } } class C8_private { private get p1_private() { return new C6_public(); } private set p1_private(m1_c3_p1_arg: C6_public) { } private get p2_private() { return new C6_public(); } private set p2_private(m1_c3_p2_arg: C6_public) { } private get p3_private() { return new C5_private(); } private set p3_private(m1_c3_p3_arg: C5_private) { } public get p4_public(): C5_private { return new C5_private(); } public set p4_public(m1_c3_p4_arg: C5_private) { } }
{ "end_byte": 4166, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyGetter.ts" }
TypeScript/tests/cases/compiler/genericInheritedDefaultConstructors.ts_0_210
// repro from #8166 interface Constructor<T> { new(...args: any[]): T; prototype: T; } class A<U> { a: U; } class B<V> extends A<V> { b: V; } var c:Constructor<B<boolean>> = B; // shouldn't error here
{ "end_byte": 210, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericInheritedDefaultConstructors.ts" }
TypeScript/tests/cases/compiler/parseReplacementCharacter.ts_0_151
"oops �� oops"; 'oops �� oops'; `oops �� oops`; `${"oops �� oops"}`; // oops �� oops /* oops �� oops */ /** oops �� oops */
{ "end_byte": 151, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/parseReplacementCharacter.ts" }
TypeScript/tests/cases/compiler/jsxExcessPropsAndAssignability.tsx_0_573
// @jsx: react // @strict: true /// <reference path="/.lib/react16.d.ts" /> import * as React from 'react'; const myHoc = <ComposedComponentProps extends any>( ComposedComponent: React.ComponentClass<ComposedComponentProps>, ) => { type WrapperComponentProps = ComposedComponentProps & { myProp: string }; const WrapperComponent: React.ComponentClass<WrapperComponentProps> = null as any; const props: ComposedComponentProps = null as any; <WrapperComponent {...props} myProp={'1000000'} />; <WrapperComponent {...props} myProp={1000000} />; };
{ "end_byte": 573, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxExcessPropsAndAssignability.tsx" }
TypeScript/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.ts_0_474
// @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 { "compilerOptions": { "baseUrl": ".", "paths": { "/*": ["./src/*"] }, "allowJs": true, "outDir": "bin" } }
{ "end_byte": 474, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.ts" }
TypeScript/tests/cases/compiler/inferSecondaryParameter.ts_0_215
// type inference on 'bug' should give 'any' interface Ib { m(test: string, fn: Function); } var b: Ib = { m: function (test: string, fn: Function) { } }; b.m("test", function (bug) { var a: number = bug; });
{ "end_byte": 215, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferSecondaryParameter.ts" }
TypeScript/tests/cases/compiler/es6ImportWithoutFromClauseInEs5.ts_0_225
// @target: es5 // @module: commonjs // @declaration: true // @filename: es6ImportWithoutFromClauseInEs5_0.ts export var a = 10; // @filename: es6ImportWithoutFromClauseInEs5_1.ts import "es6ImportWithoutFromClauseInEs5_0";
{ "end_byte": 225, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportWithoutFromClauseInEs5.ts" }
TypeScript/tests/cases/compiler/functionWithThrowButNoReturn1.ts_0_61
function fn(): number { throw new Error('NYI'); var t; }
{ "end_byte": 61, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionWithThrowButNoReturn1.ts" }
TypeScript/tests/cases/compiler/declarationMapsWithoutDeclaration.ts_0_363
// @declarationMap: true module m2 { export interface connectModule { (res, req, next): void; } export interface connectExport { use: (mod: connectModule) => connectExport; listen: (port: number) => void; } } var m2: { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; }; export = m2;
{ "end_byte": 363, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationMapsWithoutDeclaration.ts" }
TypeScript/tests/cases/compiler/nestedBlockScopedBindings4.ts_0_527
function a0() { for (let x; x < 1;) { x = x + 1; } for (let x;;) { x = x + 2; } } function a1() { for (let x; x < 1;) { x = x + 1; () => x; } for (let x;;) { x = x + 2; } } function a2() { for (let x; x < 1;) { x = x + 1; } for (let x;;) { x = x + 2; () => x; } } function a3() { for (let x; x < 1;) { x = x + 1; () => x; } for (let x;;) { x = x + 2; () => x; } }
{ "end_byte": 527, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nestedBlockScopedBindings4.ts" }
TypeScript/tests/cases/compiler/inlineSources2.ts_0_180
// @target: ES5 // @inlinesourcemap: true // @inlinesources: true // @outFile: out.js // @filename: a.ts var a = 0; console.log(a); // @filename: b.ts var b = 0; console.log(b);
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inlineSources2.ts" }
TypeScript/tests/cases/compiler/doubleUnderscoreReactNamespace.ts_0_210
// @jsx: react // @jsxFactory: __make // @module: commonjs // @filename: index.tsx declare global { function __make (params: object): any; } declare var __foot: any; const thing = <__foot />; export {}
{ "end_byte": 210, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/doubleUnderscoreReactNamespace.ts" }
TypeScript/tests/cases/compiler/spreadExpressionContextualType.ts_0_320
// @strict: true // @declaration: true // Repro from #43966 interface Orange { name: string; } interface Apple { name: string; } function test<T extends Apple | Orange>(item: T): T { return { ...item }; } function test2<T extends Apple | Orange>(item: T): T { const x = { ...item }; return x; }
{ "end_byte": 320, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spreadExpressionContextualType.ts" }
TypeScript/tests/cases/compiler/strictModeReservedWordInImportEqualDeclaration.ts_3_67
@module: commonjs "use strict" import public = require("1");
{ "end_byte": 67, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/strictModeReservedWordInImportEqualDeclaration.ts" }
TypeScript/tests/cases/compiler/mappedTypeInferenceToMappedType.ts_0_276
// @strict: true // @noEmit: true // #56133 declare class Base<T> { someProp: T; method<U extends unknown[]>(x: { [K in keyof U]: U[K] }): Base<U>; } declare class Derived<T> extends Base<T> { method<V extends unknown[]>(x: { [K in keyof V]: V[K] }): Base<V>; }
{ "end_byte": 276, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mappedTypeInferenceToMappedType.ts" }
TypeScript/tests/cases/compiler/chainedAssignment2.ts_0_102
var a: string; var b: number; var c: boolean; var d: Date; var e: RegExp; a = b = c = d = e = null;
{ "end_byte": 102, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/chainedAssignment2.ts" }
TypeScript/tests/cases/compiler/contextualTyping5.ts_0_44
class foo { public bar:{id:number;} = { }; }
{ "end_byte": 44, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/contextualTyping5.ts" }
TypeScript/tests/cases/compiler/unusedGetterInClass.ts_0_270
//@target: ES5 //@noUnusedLocals:true //@noUnusedParameters:true class Employee { private _fullName: string; private get fullName(): string { return this._fullName; } // Will not also error on the setter private set fullName(_: string) {} }
{ "end_byte": 270, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedGetterInClass.ts" }
TypeScript/tests/cases/compiler/superPropertyAccess2.ts_0_429
class C { public static foo() { } public get x() { return 1; } public static bar() { } } class D extends C { public static foo() { super.bar(); // OK super.x; // error } constructor() { super(); super.bar(); // error super.x; // error } public static get y() { super.bar(); // OK super.x; // error return 1; } }
{ "end_byte": 429, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superPropertyAccess2.ts" }
TypeScript/tests/cases/compiler/optionsOutAndNoModuleGen.ts_0_43
// @outFile: output.js export var x = 10;
{ "end_byte": 43, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/optionsOutAndNoModuleGen.ts" }
TypeScript/tests/cases/compiler/ifStatementInternalComments.ts_0_112
/*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {} /*1*/ if /*2*/ ( /*3*/ true /*4*/ ) /*5*/ {} /*6*/ else /*7*/ {}
{ "end_byte": 112, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/ifStatementInternalComments.ts" }
TypeScript/tests/cases/compiler/exportEqualsDefaultProperty.ts_1_166
// @Filename: exp.ts var x = { "greeting": "hello, world", "default": 42 }; export = x // @Filename: imp.ts import foo from "./exp"; foo.toExponential(2);
{ "end_byte": 166, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportEqualsDefaultProperty.ts" }
TypeScript/tests/cases/compiler/superAccessCastedCall.ts_0_237
class Foo { bar(): void {} } class Bar extends Foo { x: Number; constructor() { super(); this.x = 2; } bar() { super.bar(); (super.bar as any)(); } } let b = new Bar(); b.bar()
{ "end_byte": 237, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superAccessCastedCall.ts" }
TypeScript/tests/cases/compiler/jsFileCompilationTypeParameterSyntaxOfClass.ts_0_51
// @allowJs: true // @filename: a.js class C<T> { }
{ "end_byte": 51, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationTypeParameterSyntaxOfClass.ts" }
TypeScript/tests/cases/compiler/uncaughtCompilerError1.ts_0_509
declare var index, lineTokens, token, tokens; function f() { if (lineTokens[index].trim() === '=' && index > 0 && token.type === '' && tokens[index - 1].type === 'attribute.name.html') { if (index === (tokens.length - 1)) { return { appendText: '\"\"', advanceCount: 1 }; } else if (tokens[index + 1].type !== 'attribute.value.html' && tokens[index + 1].type !== '') { return { appendText: '\"\"', advanceCount: 1 }; } return null; } }
{ "end_byte": 509, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/uncaughtCompilerError1.ts" }
TypeScript/tests/cases/compiler/assignmentCompatability24.ts_0_374
module __test1__ { export interface interfaceWithPublicAndOptional<T,U> { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional<number,string> = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { export var obj = function f<Tstring>(a: Tstring) { return a; };; export var __val__obj = obj; } __test2__.__val__obj = __test1__.__val__obj4
{ "end_byte": 374, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability24.ts" }
TypeScript/tests/cases/compiler/thisInPropertyBoundDeclarations.ts_0_1012
class Bug { private name: string; private static func: Function[] = [ (that: Bug, name: string) => { that.foo(name); } ]; private foo(name: string) { this.name = name; } } // Valid use of this in a property bound decl class A { prop1 = function() { this; }; prop2 = function() { function inner() { this; } () => this; }; prop3 = () => { function inner() { this; } }; prop4 = { a: function() { return this; }, }; prop5 = () => { return { a: function() { return this; }, }; }; } class B { prop1 = this; prop2 = () => this; prop3 = () => () => () => () => this; prop4 = ' ' + function() { } + ' ' + (() => () => () => this); prop5 = { a: () => { return this; } }; prop6 = () => { return { a: () => { return this; } }; }; }
{ "end_byte": 1012, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInPropertyBoundDeclarations.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationGlobal5.ts_0_344
// @module: commonjs // @declaration: true // @filename: f1.d.ts declare module "A" { global { interface Something {x} } } // @filename: f2.d.ts declare module "B" { global { interface Something {y} } } // @filename: f3.ts /// <reference path="f1.d.ts"/> /// <reference path="f2.d.ts"/> import "A"; import "B";
{ "end_byte": 344, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationGlobal5.ts" }
TypeScript/tests/cases/compiler/importAndVariableDeclarationConflict4.ts_0_63
module m { export var m = ''; } var x = ''; import x = m.m;
{ "end_byte": 63, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importAndVariableDeclarationConflict4.ts" }
TypeScript/tests/cases/compiler/overloadOnConstInheritance1.ts_0_210
interface Base { addEventListener(x: string): any; addEventListener(x: 'foo'): string; } interface Deriver extends Base { addEventListener(x: string): any; addEventListener(x: 'bar'): string; }
{ "end_byte": 210, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadOnConstInheritance1.ts" }
TypeScript/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts_0_2580
// @target: es2015 // @declaration: true // GH#37454, GH#41044 type O = { a?: string; b: number; c: number; }; type F1 = (arg: number) => any; // OK type F2 = ({ a: string }: O) => any; // Error type F3 = ({ a: string, b, c }: O) => any; // Error type F4 = ({ a: string }: O) => any; // Error type F5 = ({ a: string, b, c }: O) => any; // Error type F6 = ({ a: string }) => typeof string; // OK type F7 = ({ a: string, b: number }) => typeof number; // Error type F8 = ({ a, b: number }) => typeof number; // OK type F9 = ([a, b, c]) => void; // OK type G1 = new (arg: number) => any; // OK type G2 = new ({ a: string }: O) => any; // Error type G3 = new ({ a: string, b, c }: O) => any; // Error type G4 = new ({ a: string }: O) => any; // Error type G5 = new ({ a: string, b, c }: O) => any; // Error type G6 = new ({ a: string }) => typeof string; // OK type G7 = new ({ a: string, b: number }) => typeof number; // Error type G8 = new ({ a, b: number }) => typeof number; // OK type G9 = new ([a, b, c]) => void; // OK // Below are Error but renaming is retained in declaration emit, // since elinding it would leave invalid syntax. type F10 = ({ "a": string }) => void; // Error type F11 = ({ 2: string }) => void; // Error type F12 = ({ ["a"]: string }: O) => void; // Error type F13 = ({ [2]: string }) => void; // Error type G10 = new ({ "a": string }) => void; // Error type G11 = new ({ 2: string }) => void; // Error type G12 = new ({ ["a"]: string }: O) => void; // Error type G13 = new ({ [2]: string }) => void; // Error interface I { method1(arg: number): any; // OK method2({ a: string }): any; // Error (arg: number): any; // OK ({ a: string }): any; // Error new (arg: number): any; // OK new ({ a: string }): any; // Error } // Below are OK but renaming should be removed from declaration emit function f1({ a: string }: O) { } const f2 = function({ a: string }: O) { }; const f3 = ({ a: string, b, c }: O) => { }; const f4 = function({ a: string }: O): typeof string { return string; }; const f5 = ({ a: string, b, c }: O): typeof string => ''; const obj1 = { method({ a: string }: O) { } }; const obj2 = { method({ a: string }: O): typeof string { return string; } }; function f6({ a: string = "" }: O) { } const f7 = ({ a: string = "", b, c }: O) => { }; const f8 = ({ "a": string }: O) => { }; function f9 ({ 2: string }) { }; function f10 ({ ["a"]: string }: O) { }; const f11 = ({ [2]: string }) => { }; // In below case `string` should be kept because it is used function f12({ a: string = "" }: O): typeof string { return "a"; }
{ "end_byte": 2580, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts" }
TypeScript/tests/cases/compiler/internalAliasVar.ts_0_117
// @declaration: true module a { export var x = 10; } module c { import b = a.x; export var bVal = b; }
{ "end_byte": 117, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasVar.ts" }
TypeScript/tests/cases/compiler/jsFileCompilationExportAssignmentSyntax.ts_0_48
// @allowJs: true // @filename: a.js export = b;
{ "end_byte": 48, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationExportAssignmentSyntax.ts" }
TypeScript/tests/cases/compiler/icomparable.ts_4_261
interface IComparable<T> { compareTo(other: T); } declare function sort<U extends IComparable<any>>(items: U[]): U[]; interface StringComparable extends IComparable<string> { } var sc: StringComparable[]; var x = sort(sc);
{ "end_byte": 261, "start_byte": 4, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/icomparable.ts" }
TypeScript/tests/cases/compiler/duplicateTypeParameters2.ts_0_99
class A { public foo() { } } class B { public bar() { } } interface I<T extends A, T extends B> {}
{ "end_byte": 99, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/duplicateTypeParameters2.ts" }
TypeScript/tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts_0_73
export class Class { #field: any } const task: Class = {} as unknown;
{ "end_byte": 73, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts" }
TypeScript/tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts_0_402
// @Filename: importAliasAnExternalModuleInsideAnInternalModule_file0.ts export module m { export function foo() { } } // @Filename: importAliasAnExternalModuleInsideAnInternalModule_file1.ts import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0'); module m_private { //import r2 = require('m'); // would be error export import C = r; // no error C.m.foo(); }
{ "end_byte": 402, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts" }
TypeScript/tests/cases/compiler/unaryOperators1.ts_0_18
+foo; -bar; ~quux;
{ "end_byte": 18, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unaryOperators1.ts" }
TypeScript/tests/cases/compiler/duplicateLocalVariable2.ts_0_958
//@module: amd export class TestCase { constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { } } export class TestRunner { static arrayCompare(arg1: any[], arg2: any[]): boolean { return false; } public addTest(test: TestCase) { } } export var tests: TestRunner = (function () { var testRunner = new TestRunner(); testRunner.addTest(new TestCase("Check UTF8 encoding", function () { var fb: any; fb.writeUtf8Bom(); var chars = [0x0054]; for (var i in chars) { fb.writeUtf8CodePoint(chars[i]); } fb.index = 0; var bytes = []; for (var i = 0; i < 14; i++) { bytes.push(fb.readByte()); } var expected = [0xEF]; return TestRunner.arrayCompare(bytes, expected); })); return testRunner; })();
{ "end_byte": 958, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/duplicateLocalVariable2.ts" }
TypeScript/tests/cases/compiler/privacyImportParseErrors.ts_0_6261
//@module: commonjs export module m1 { export module m1_M1_public { export class c1 { } export function f1() { return new c1; } export var v1 = c1; export var v2: c1; } module m1_M2_private { export class c1 { } export function f1() { return new c1; } export var v1 = c1; export var v2: c1; } export declare module "m1_M3_public" { export function f1(); export class c1 { } export var v1: { new (): c1; }; export var v2: c1; } declare module "m1_M4_private" { export function f1(); export class c1 { } export var v1: { new (): c1; }; export var v2: c1; } import m1_im1_private = m1_M1_public; export var m1_im1_private_v1_public = m1_im1_private.c1; export var m1_im1_private_v2_public = new m1_im1_private.c1(); export var m1_im1_private_v3_public = m1_im1_private.f1; export var m1_im1_private_v4_public = m1_im1_private.f1(); var m1_im1_private_v1_private = m1_im1_private.c1; var m1_im1_private_v2_private = new m1_im1_private.c1(); var m1_im1_private_v3_private = m1_im1_private.f1; var m1_im1_private_v4_private = m1_im1_private.f1(); import m1_im2_private = m1_M2_private; export var m1_im2_private_v1_public = m1_im2_private.c1; export var m1_im2_private_v2_public = new m1_im2_private.c1(); export var m1_im2_private_v3_public = m1_im2_private.f1; export var m1_im2_private_v4_public = m1_im2_private.f1(); var m1_im2_private_v1_private = m1_im2_private.c1; var m1_im2_private_v2_private = new m1_im2_private.c1(); var m1_im2_private_v3_private = m1_im2_private.f1; var m1_im2_private_v4_private = m1_im2_private.f1(); import m1_im3_private = require("m1_M3_public"); export var m1_im3_private_v1_public = m1_im3_private.c1; export var m1_im3_private_v2_public = new m1_im3_private.c1(); export var m1_im3_private_v3_public = m1_im3_private.f1; export var m1_im3_private_v4_public = m1_im3_private.f1(); var m1_im3_private_v1_private = m1_im3_private.c1; var m1_im3_private_v2_private = new m1_im3_private.c1(); var m1_im3_private_v3_private = m1_im3_private.f1; var m1_im3_private_v4_private = m1_im3_private.f1(); import m1_im4_private = require("m1_M4_private"); export var m1_im4_private_v1_public = m1_im4_private.c1; export var m1_im4_private_v2_public = new m1_im4_private.c1(); export var m1_im4_private_v3_public = m1_im4_private.f1; export var m1_im4_private_v4_public = m1_im4_private.f1(); var m1_im4_private_v1_private = m1_im4_private.c1; var m1_im4_private_v2_private = new m1_im4_private.c1(); var m1_im4_private_v3_private = m1_im4_private.f1; var m1_im4_private_v4_private = m1_im4_private.f1(); export import m1_im1_public = m1_M1_public; export import m1_im2_public = m1_M2_private; export import m1_im3_public = require("m1_M3_public"); export import m1_im4_public = require("m1_M4_private"); } module m2 { export module m2_M1_public { export class c1 { } export function f1() { return new c1; } export var v1 = c1; export var v2: c1; } module m2_M2_private { export class c1 { } export function f1() { return new c1; } export var v1 = c1; export var v2: c1; } export declare module "m2_M3_public" { export function f1(); export class c1 { } export var v1: { new (): c1; }; export var v2: c1; } declare module "m2_M4_private" { export function f1(); export class c1 { } export var v1: { new (): c1; }; export var v2: c1; } import m1_im1_private = m2_M1_public; export var m1_im1_private_v1_public = m1_im1_private.c1; export var m1_im1_private_v2_public = new m1_im1_private.c1(); export var m1_im1_private_v3_public = m1_im1_private.f1; export var m1_im1_private_v4_public = m1_im1_private.f1(); var m1_im1_private_v1_private = m1_im1_private.c1; var m1_im1_private_v2_private = new m1_im1_private.c1(); var m1_im1_private_v3_private = m1_im1_private.f1; var m1_im1_private_v4_private = m1_im1_private.f1(); import m1_im2_private = m2_M2_private; export var m1_im2_private_v1_public = m1_im2_private.c1; export var m1_im2_private_v2_public = new m1_im2_private.c1(); export var m1_im2_private_v3_public = m1_im2_private.f1; export var m1_im2_private_v4_public = m1_im2_private.f1(); var m1_im2_private_v1_private = m1_im2_private.c1; var m1_im2_private_v2_private = new m1_im2_private.c1(); var m1_im2_private_v3_private = m1_im2_private.f1; var m1_im2_private_v4_private = m1_im2_private.f1(); import m1_im3_private = require("m2_M3_public"); export var m1_im3_private_v1_public = m1_im3_private.c1; export var m1_im3_private_v2_public = new m1_im3_private.c1(); export var m1_im3_private_v3_public = m1_im3_private.f1; export var m1_im3_private_v4_public = m1_im3_private.f1(); var m1_im3_private_v1_private = m1_im3_private.c1; var m1_im3_private_v2_private = new m1_im3_private.c1(); var m1_im3_private_v3_private = m1_im3_private.f1; var m1_im3_private_v4_private = m1_im3_private.f1(); import m1_im4_private = require("m2_M4_private"); export var m1_im4_private_v1_public = m1_im4_private.c1; export var m1_im4_private_v2_public = new m1_im4_private.c1(); export var m1_im4_private_v3_public = m1_im4_private.f1; export var m1_im4_private_v4_public = m1_im4_private.f1(); var m1_im4_private_v1_private = m1_im4_private.c1; var m1_im4_private_v2_private = new m1_im4_private.c1(); var m1_im4_private_v3_private = m1_im4_private.f1; var m1_im4_private_v4_private = m1_im4_private.f1(); // Parse error to export module export import m1_im1_public = m2_M1_public; export import m1_im2_public = m2_M2_private; export import m1_im3_public = require("m2_M3_public"); export import m1_im4_public = require("m2_M4_private"); }
{ "end_byte": 6261, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyImportParseErrors.ts" }
TypeScript/tests/cases/compiler/privacyImportParseErrors.ts_6263_12399
export module glo_M1_public { export class c1 { } export function f1() { return new c1; } export var v1 = c1; export var v2: c1; } export declare module "glo_M2_public" { export function f1(); export class c1 { } export var v1: { new (): c1; }; export var v2: c1; } export module glo_M3_private { export class c1 { } export function f1() { return new c1; } export var v1 = c1; export var v2: c1; } export declare module "glo_M4_private" { export function f1(); export class c1 { } export var v1: { new (): c1; }; export var v2: c1; } import glo_im1_private = glo_M1_public; export var glo_im1_private_v1_public = glo_im1_private.c1; export var glo_im1_private_v2_public = new glo_im1_private.c1(); export var glo_im1_private_v3_public = glo_im1_private.f1; export var glo_im1_private_v4_public = glo_im1_private.f1(); var glo_im1_private_v1_private = glo_im1_private.c1; var glo_im1_private_v2_private = new glo_im1_private.c1(); var glo_im1_private_v3_private = glo_im1_private.f1; var glo_im1_private_v4_private = glo_im1_private.f1(); import glo_im2_private = require("glo_M2_public"); export var glo_im2_private_v1_public = glo_im2_private.c1; export var glo_im2_private_v2_public = new glo_im2_private.c1(); export var glo_im2_private_v3_public = glo_im2_private.f1; export var glo_im2_private_v4_public = glo_im2_private.f1(); var glo_im2_private_v1_private = glo_im2_private.c1; var glo_im2_private_v2_private = new glo_im2_private.c1(); var glo_im2_private_v3_private = glo_im2_private.f1; var glo_im2_private_v4_private = glo_im2_private.f1(); import glo_im3_private = glo_M3_private; export var glo_im3_private_v1_public = glo_im3_private.c1; export var glo_im3_private_v2_public = new glo_im3_private.c1(); export var glo_im3_private_v3_public = glo_im3_private.f1; export var glo_im3_private_v4_public = glo_im3_private.f1(); var glo_im3_private_v1_private = glo_im3_private.c1; var glo_im3_private_v2_private = new glo_im3_private.c1(); var glo_im3_private_v3_private = glo_im3_private.f1; var glo_im3_private_v4_private = glo_im3_private.f1(); import glo_im4_private = require("glo_M4_private"); export var glo_im4_private_v1_public = glo_im4_private.c1; export var glo_im4_private_v2_public = new glo_im4_private.c1(); export var glo_im4_private_v3_public = glo_im4_private.f1; export var glo_im4_private_v4_public = glo_im4_private.f1(); var glo_im4_private_v1_private = glo_im4_private.c1; var glo_im4_private_v2_private = new glo_im4_private.c1(); var glo_im4_private_v3_private = glo_im4_private.f1; var glo_im4_private_v4_private = glo_im4_private.f1(); // Parse error to export module export import glo_im1_public = glo_M1_public; export import glo_im2_public = glo_M3_private; export import glo_im3_public = require("glo_M2_public"); export import glo_im4_public = require("glo_M4_private"); export declare module "use_glo_M1_public" { import use_glo_M1_public = glo_M1_public; export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; }; export var use_glo_M1_public_v2_public: use_glo_M1_public; export var use_glo_M1_public_v3_public: () => use_glo_M1_public.c1; var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; }; var use_glo_M1_public_v2_private: use_glo_M1_public; var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1; import use_glo_M2_public = require("glo_M2_public"); export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; }; export var use_glo_M2_public_v2_public: use_glo_M2_public; export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1; var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; }; var use_glo_M2_public_v2_private: use_glo_M2_public; var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1; module m2 { import errorImport = require("glo_M2_public"); import nonerrorImport = glo_M1_public; module m5 { import m5_errorImport = require("glo_M2_public"); import m5_nonerrorImport = glo_M1_public; } } } declare module "use_glo_M3_private" { import use_glo_M3_private = glo_M3_private; export var use_glo_M3_private_v1_public: { new (): use_glo_M3_private.c1; }; export var use_glo_M3_private_v2_public: use_glo_M3_private; export var use_glo_M3_private_v3_public: () => use_glo_M3_private.c1; var use_glo_M3_private_v1_private: { new (): use_glo_M3_private.c1; }; var use_glo_M3_private_v2_private: use_glo_M3_private; var use_glo_M3_private_v3_private: () => use_glo_M3_private.c1; import use_glo_M4_private = require("glo_M4_private"); export var use_glo_M4_private_v1_public: { new (): use_glo_M4_private.c1; }; export var use_glo_M4_private_v2_public: use_glo_M4_private; export var use_glo_M4_private_v3_public: () => use_glo_M4_private.c1; var use_glo_M4_private_v1_private: { new (): use_glo_M4_private.c1; }; var use_glo_M4_private_v2_private: use_glo_M4_private; var use_glo_M4_private_v3_private: () => use_glo_M4_private.c1; module m2 { import errorImport = require("glo_M4_private"); import nonerrorImport = glo_M3_private; module m5 { import m5_errorImport = require("glo_M4_private"); import m5_nonerrorImport = glo_M3_private; } } } declare module "anotherParseError" { module m2 { declare module "abc" { } } module m2 { module "abc2" { } } module "abc3" { } } declare export module "anotherParseError2" { module m2 { declare module "abc" { } } module m2 { module "abc2" { } } module "abc3" { } } module m2 { import m3 = require("use_glo_M1_public"); module m4 { var a = 10; import m2 = require("use_glo_M1_public"); } } export module m3 { import m3 = require("use_glo_M1_public"); module m4 { var a = 10; import m2 = require("use_glo_M1_public"); } }
{ "end_byte": 12399, "start_byte": 6263, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyImportParseErrors.ts" }
TypeScript/tests/cases/compiler/correctOrderOfPromiseMethod.ts_0_667
// @skipLibCheck: true // @lib: dom, es7 interface A { id: string } interface B { id: string fieldB: string } async function countEverything(): Promise<number> { const providerA = async (): Promise<A[]> => { return [] } const providerB = async (): Promise<B[]> => { return [] } const [resultA, resultB] = await Promise.all([ providerA(), providerB(), ]); const dataA: A[] = resultA; const dataB: B[] = resultB; if (dataA && dataB) { return dataA.length + dataB.length; } return 0; } // #31179 const expected: Promise<["a", "b", "c"]> = Promise.all(undefined as readonly ["a", "b", "c"]);
{ "end_byte": 667, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/correctOrderOfPromiseMethod.ts" }
TypeScript/tests/cases/compiler/reverseMappedIntersectionInference1.ts_0_644
// @strict: true // @noEmit: true type Results<T> = { [K in keyof T]: { data: T[K]; onSuccess: (data: T[K]) => void; }; }; type Errors<E> = { [K in keyof E]: { error: E[K]; onError: (data: E[K]) => void; }; }; declare function withKeyedObj<T, E>( arg: Results<T> & Errors<E> ): [T, E]; const res = withKeyedObj({ a: { data: "foo", onSuccess: (dataArg) => { dataArg; }, error: 404, onError: (errorArg) => { errorArg; }, }, b: { data: true, onSuccess: (dataArg) => { dataArg; }, error: 500, onError: (errorArg) => { errorArg; }, }, });
{ "end_byte": 644, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/reverseMappedIntersectionInference1.ts" }
TypeScript/tests/cases/compiler/circularInlineMappedGenericTupleTypeNoCrash.ts_0_416
// @strict: true // @noEmit: true class Foo<Elements extends readonly unknown[]> { public readonly elements: { [P in keyof Elements]: { bar: Elements[P] } }; public constructor( ...elements: { [P in keyof Elements]: { bar: Elements[P] } } ) { this.elements = elements; } public add(): Foo<[...Elements, "abc"]> { return new Foo<[...Elements, "abc"]>(...this.elements, { bar: "abc" }); } }
{ "end_byte": 416, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/circularInlineMappedGenericTupleTypeNoCrash.ts" }
TypeScript/tests/cases/compiler/letDeclarations-scopes.ts_0_1736
// @allowUnusedLabels: true // @allowUnreachableCode: true // @target: ES6 // global let l = "string"; var n: number; // Control flow statements with blocks if (true) { let l = 0; n = l; } else { let l = 0; n = l; } while (true) { let l = 0; n = l; } do { let l = 0; n = l; } while (true); var obj; with (obj) { let l = 0; n = l; } for (var i = 0; i < 10; i++) { let l = 0; n = l; } for (var i2 in {}) { let l = 0; n = l; } if (true) { label: let l = 0; n = l; } while (false) { label2: label3: label4: let l = 0; n = l; } for (let l = 0; n = l; l++) { let l = true; var b3: boolean = l; } for (let l in {}) { } // Try/catch/finally try { let l = 0; n = l; } catch (e) { let l = 0; n = l; } finally { let l = 0; n = l; } // Switch switch (0) { case 0: let l = 0; n = l; break; } // blocks { let l = 0; n = l; { let l = false; var b: boolean = l; } } // functions function F() { let l = 0; n = l; } var F2 = () => { let l = 0; n = l; }; var F3 = function () { let l = 0; n = l; }; // modules module m { let l = 0; n = l; { let l = false; var b2: boolean = l; } lable: let l2 = 0; } // methods class C { constructor() { let l = 0; n = l; } method() { let l = 0; n = l; } get v() { let l = 0; n = l; return n; } set v(value) { let l = 0; n = l; } } // object literals var o = { f() { let l = 0; n = l; }, f2: () => { let l = 0; n = l; } }
{ "end_byte": 1736, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/letDeclarations-scopes.ts" }
TypeScript/tests/cases/compiler/namedImportNonExistentName.ts_0_341
// @filename: foo.d.ts export = Foo; export as namespace Foo; declare namespace Foo { function foo(); } // @filename: foo2.ts let x: { a: string; c: string; } | { b: number; c: number; }; export = x // @filename: bar.ts import { Bar, toString, foo } from './foo'; foo(); import { a, b, c, d, toString as foo2String } from './foo2'; c;
{ "end_byte": 341, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/namedImportNonExistentName.ts" }
TypeScript/tests/cases/compiler/exportAsNamespaceConflict.ts_0_91
// @Filename: /a.d.ts declare global { namespace N {} } export = N; export as namespace N;
{ "end_byte": 91, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportAsNamespaceConflict.ts" }
TypeScript/tests/cases/compiler/incorrectRecursiveMappedTypeConstraint.ts_0_116
// #17847 function sum<T extends { [P in T]: number }, K extends keyof T>(n: number, v: T, k: K) { n += v[k]; }
{ "end_byte": 116, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/incorrectRecursiveMappedTypeConstraint.ts" }
TypeScript/tests/cases/compiler/systemModule7.ts_0_167
// @module: system // filename: instantiatedModule.ts export module M { var x = 1; } // filename: nonInstantiatedModule.ts export module M { interface I {} }
{ "end_byte": 167, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/systemModule7.ts" }
TypeScript/tests/cases/compiler/downlevelLetConst11.ts_0_17
"use strict"; let
{ "end_byte": 17, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/downlevelLetConst11.ts" }
TypeScript/tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts_0_93
// @removeComments: false function Foo(x: any) { } Foo(() => // do something 127);
{ "end_byte": 93, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts" }
TypeScript/tests/cases/compiler/argumentsSpreadRestIterables.tsx_0_622
// @strict: true // @noEmit: true // @target: es5, esnext declare const itNum: Iterable<number> ;(function(...rest) {})(...itNum) ;(function(a, ...rest) {})('', ...itNum) ;(function(a, ...rest) {})('', true, ...itNum) declare function fn1<const T extends readonly unknown[]>(...args: T): T; const res1 = fn1(..."hello"); const res2 = fn1(...itNum); const res3 = fn1(true, ..."hello"); const res4 = fn1(true, ...itNum); // repro from #52781 declare function foo<T extends unknown[]>(...args: T): T; const p1 = foo(..."hello"); const p2 = foo(...itNum); const p3 = foo(true, ..."hello"); const p4 = foo(true, ...itNum);
{ "end_byte": 622, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/argumentsSpreadRestIterables.tsx" }
TypeScript/tests/cases/compiler/errorWithSameNameType.ts_0_238
// @filename: a.ts export interface F { foo1: number } // @filename: b.ts export interface F { foo2: number } // @filename: c.ts import * as A from './a' import * as B from './b' let a: A.F let b: B.F if (a === b) { } a = b
{ "end_byte": 238, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/errorWithSameNameType.ts" }
TypeScript/tests/cases/compiler/indexer2A.ts_0_256
class IHeapObjectProperty { } class IDirectChildrenMap { // Decided to enforce a semicolon after declarations hasOwnProperty(objectId: number): boolean [objectId: number]: IHeapObjectProperty[] } var directChildrenMap = <IDirectChildrenMap>{};
{ "end_byte": 256, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/indexer2A.ts" }
TypeScript/tests/cases/compiler/selfReferencingTypeReferenceInference.ts_0_414
interface Box<T> { __: T } type Recursive<T> = | T | Box<Recursive<T>> type InferRecursive<T> = T extends Recursive<infer R> ? R : "never!" // the type we are testing with type t1 = Box<string | Box<number | boolean>> type t2 = InferRecursive<t1> type t3 = InferRecursive<Box<string | Box<number | boolean>>> // write t1 explicitly // Why is t2 and t3 different?? // They have same input type!
{ "end_byte": 414, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/selfReferencingTypeReferenceInference.ts" }
TypeScript/tests/cases/compiler/checkInterfaceBases.ts_0_295
//@module: commonjs // @Filename: jquery.d.ts interface JQueryEventObjectTest { data: any; which: number; metaKey: any; } // @Filename: app.ts ///<reference path='jquery.d.ts' /> interface SecondEvent { data: any; } interface Third extends JQueryEventObjectTest, SecondEvent {}
{ "end_byte": 295, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/checkInterfaceBases.ts" }
TypeScript/tests/cases/compiler/templateLiteralsSourceMap.ts_0_50
// @sourcemap: true const s = `a${0}b${1}c${2}`;
{ "end_byte": 50, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/templateLiteralsSourceMap.ts" }
TypeScript/tests/cases/compiler/letDeclarations.ts_0_233
// @target: ES6 // @declaration: true let l1; let l2: number; let l3, l4, l5 :string, l6; let l7 = false; let l8: number = 23; let l9 = 0, l10 :string = "", l11 = null; for(let l11 in {}) { } for(let l12 = 0; l12 < 9; l12++) { }
{ "end_byte": 233, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/letDeclarations.ts" }
TypeScript/tests/cases/compiler/unusedImports6.ts_0_240
//@noUnusedLocals:true //@noUnusedParameters:true // @Filename: file1.ts export class Calculator { handleChar() {} } export function test() { } export default function test2() { } // @Filename: file2.ts import d from "./file1"
{ "end_byte": 240, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedImports6.ts" }
TypeScript/tests/cases/compiler/continueTarget4.ts_0_83
// @allowUnusedLabels: true target1: target2: while (true) { continue target2; }
{ "end_byte": 83, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/continueTarget4.ts" }
TypeScript/tests/cases/compiler/conditionalTypeClassMembers.ts_0_243
declare class MyRecord { private a(); b(): unknown; } declare class MySet<TSet extends MyRecord> { public item(): TSet; } type DS<TRec extends MyRecord | { [key: string]: unknown }> = TRec extends MyRecord ? MySet<TRec> : TRec[];
{ "end_byte": 243, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionalTypeClassMembers.ts" }
TypeScript/tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts_3_155
@target: es6 function f(x: TemplateStringsArray, y: string, z: string) { } // Incomplete call, but too many parameters. f `123qdawdrqw${ 1 }${ }${
{ "end_byte": 155, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts" }
TypeScript/tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExportAccessError.ts_0_305
//@module: commonjs export module x { export class c { foo(a: number) { return a; } } } export module m2 { export module m3 { import c = x.c; export var cProp = new c(); var cReturnVal = cProp.foo(10); } } export var d = new m2.m3.c();
{ "end_byte": 305, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExportAccessError.ts" }
TypeScript/tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts_0_89
// @noUnusedLocals: true class C { private x; m() { this.x = 0; } }
{ "end_byte": 89, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts" }
TypeScript/tests/cases/compiler/selfReferentialFunctionType.ts_0_169
// @strict: true // @declaration: true declare function f<T>(args: typeof f<T>): T; declare function g<T = typeof g>(args: T): T; declare function h<T>(): typeof h<T>;
{ "end_byte": 169, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/selfReferentialFunctionType.ts" }
TypeScript/tests/cases/compiler/instanceOfAssignability.ts_0_1515
interface Base { foo: string|number; optional?: number; } // Derived1 is assignable to, but not a subtype of, Base class Derived1 implements Base { foo: string; } // Derived2 is a subtype of Base that is not assignable to Derived1 class Derived2 implements Base { foo: number; optional: number; } class Animal { move; } class Mammal extends Animal { milk; } class Giraffe extends Mammal { neck; } function fn1(x: Array<number>|Array<string>|boolean) { if(x instanceof Array) { // 1.5: y: Array<number>|Array<string> // Want: y: Array<number>|Array<string> let y = x; } } function fn2(x: Base) { if(x instanceof Derived1) { // 1.5: y: Base // Want: y: Derived1 let y = x; } } function fn3(x: Base|Derived1) { if(x instanceof Derived2) { // 1.5: y: Derived2 // Want: Derived2 let y = x; } } function fn4(x: Base|Derived2) { if(x instanceof Derived1) { // 1.5: y: {} // Want: Derived1 let y = x; } } function fn5(x: Derived1) { if(x instanceof Derived2) { // 1.5: y: Derived1 // Want: ??? let y = x; } } function fn6(x: Animal|Mammal) { if(x instanceof Giraffe) { // 1.5: y: Derived1 // Want: ??? let y = x; } } function fn7(x: Array<number>|Array<string>) { if(x instanceof Array) { // 1.5: y: Array<number>|Array<string> // Want: y: Array<number>|Array<string> let y = x; } } interface Alpha { a } interface Beta { b } interface Gamma { c } class ABC { a; b; c; } function fn8(x: Alpha|Beta|Gamma) { if(x instanceof ABC) { let y = x; } }
{ "end_byte": 1515, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/instanceOfAssignability.ts" }
TypeScript/tests/cases/compiler/deferredLookupTypeResolution2.ts_0_779
// @strict: true // @declaration: true // Repro from #17456 type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' } & { [key: string]: 'false'})[L]; type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>; type A<T> = ObjectHasKey<T, '0'>; type B = ObjectHasKey<[string, number], '1'>; // "true" type C = ObjectHasKey<[string, number], '2'>; // "false" type D = A<[string]>; // "true" // Error, "false" not handled type E<T> = { true: 'true' }[ObjectHasKey<T, '1'>]; type Juxtapose<T> = ({ true: 'otherwise' } & { [k: string]: 'true' })[ObjectHasKey<T, '1'>]; // Error, "otherwise" is missing type DeepError<T> = { true: 'true' }[Juxtapose<T>]; type DeepOK<T> = { true: 'true', otherwise: 'false' }[Juxtapose<T>];
{ "end_byte": 779, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deferredLookupTypeResolution2.ts" }
TypeScript/tests/cases/compiler/declarationEmitRecursiveConditionalAliasPreserved.ts_0_2960
// @declaration: true // @filename: input.d.ts type _BuildPowersOf2LengthArrays< Length extends number, AccumulatedArray extends never[][], > = AccumulatedArray[0][Length] extends never ? AccumulatedArray : _BuildPowersOf2LengthArrays< Length, [[...AccumulatedArray[0], ...AccumulatedArray[0]], ...AccumulatedArray] >; type _ConcatLargestUntilDone< Length extends number, AccumulatedArray extends never[][], NextArray extends never[], > = NextArray['length'] extends Length ? NextArray : [...AccumulatedArray[0], ...NextArray][Length] extends never ? _ConcatLargestUntilDone< Length, AccumulatedArray extends [AccumulatedArray[0], ...infer U] ? U extends never[][] ? U : never : never, NextArray > : _ConcatLargestUntilDone< Length, AccumulatedArray extends [AccumulatedArray[0], ...infer U] ? U extends never[][] ? U : never : never, [...AccumulatedArray[0], ...NextArray] > type _Replace<R extends unknown[], T> = { [K in keyof R]: T }; export type TupleOf<Type, Length extends number> = number extends Length ? Type[] : { // in case Length is a union [LengthKey in Length]: _BuildPowersOf2LengthArrays< LengthKey, [[never]] > extends infer TwoDimensionalArray ? TwoDimensionalArray extends never[][] ? _Replace<_ConcatLargestUntilDone<LengthKey, TwoDimensionalArray, []>, Type> : never : never }[Length]; export type Subtract<N1 extends number, N2 extends number> = TupleOf<never, N1> extends [ ...TupleOf<never, N2>, ...infer R, ] ? R['length'] : never; export type Decrement<T extends number> = Subtract<T, 1>; export type Add<N1 extends number, N2 extends number> = [ ...TupleOf<never, N1>, ...TupleOf<never, N2>, ]['length'] & // intersection to suppress compiler narrowing bug number; type _MultiAdd< Num extends number, Accumulator extends number, IterationsLeft extends number, > = IterationsLeft extends 0 ? Accumulator : _MultiAdd<Num, Add<Num, Accumulator>, Decrement<IterationsLeft>> export type Multiply<N1 extends number, N2 extends number> = number extends N1 | N2 ? number : { [K2 in N2]: { [K1 in N1]: _MultiAdd<K1, 0, N2> }[N1] }[N2] type PowerTailRec< Num extends number, PowerOf extends number, Result extends number, > = number extends PowerOf ? number : PowerOf extends 0 ? Result : PowerTailRec<Num, Decrement<PowerOf>, Multiply<Result, Num>>; export type Power<Num extends number, PowerOf extends number> = PowerTailRec<Num, PowerOf, 1>; // @filename: a.tsx import { Power } from "./input"; export const power = <Num extends number, PowerOf extends number>( num: Num, powerOf: PowerOf ): Power<Num, PowerOf> => (num ** powerOf) as never;
{ "end_byte": 2960, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitRecursiveConditionalAliasPreserved.ts" }
TypeScript/tests/cases/compiler/stringRawType.ts_3_70
@target: es6 String.raw({ raw: ["foo", "bar", "baz"] }, 1, 2);
{ "end_byte": 70, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/stringRawType.ts" }
TypeScript/tests/cases/compiler/assignmentCompatability10.ts_0_464
module __test1__ { export interface interfaceWithPublicAndOptional<T,U> { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional<number,string> = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { export class classWithPublicAndOptional<T,U> { constructor(public one: T, public two?: U) {} } var x4 = new classWithPublicAndOptional<number, string>(1);; export var __val__x4 = x4; } __test2__.__val__x4 = __test1__.__val__obj4
{ "end_byte": 464, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability10.ts" }
TypeScript/tests/cases/compiler/readonlyTupleAndArrayElaboration.ts_0_1391
// @strict // #Repro from #30839 let point = [3, 4] as const; function distanceFromOrigin([x, y]: [number, number]) { return Math.sqrt(x ** 2 + y ** 2); } distanceFromOrigin(point); declare function arryFn(x: number[]): void; arryFn(point); declare function arryFn2(x: Array<number>): void; arryFn2(point); declare const a: readonly number[]; declare const b: Readonly<number[]>; declare const c: ReadonlyArray<number>; arryFn2(a); arryFn2(b); arryFn2(c); const t1: readonly [1] = [1]; const t2: readonly [] = t1; const t3: readonly [1] = [1]; const t4: [] = t3; const t5: [1] = [1]; const t6: readonly [] = t5; const t7: [1] = [1]; const t8: [] = t7; const a1: readonly number[] = [1]; const a2: readonly boolean[] = a1; const a3: readonly number[] = [1]; const a4: boolean[] = a3; const a5: number[] = [1]; const a6: readonly boolean [] = a5; const a7: number[] = [1]; const a8: boolean[] = a7; const ta1: readonly [1] = [1]; const ta2: readonly boolean[] = ta1; const ta3: readonly [1] = [1]; const ta4: number[] = ta3; const ta5: [1] = [1]; const ta6: readonly boolean[] = ta5; const ta7: [1] = [1]; const ta8: boolean[] = ta7; const at1: readonly number[] = [1]; const at2: readonly [1] = at1; const at3: readonly number[] = [1]; const at4: [1] = at3; const at5: number[] = [1]; const at6: readonly [1] = at5; const at7: number[] = [1]; const at8: [1] = at7;
{ "end_byte": 1391, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/readonlyTupleAndArrayElaboration.ts" }
TypeScript/tests/cases/compiler/keyofObjectWithGlobalSymbolIncluded.ts_0_106
// @target: es6 // @strict: true const obj = { [Symbol.species]: Array }; type Q = keyof typeof obj;
{ "end_byte": 106, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/keyofObjectWithGlobalSymbolIncluded.ts" }
TypeScript/tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts_0_444
interface Comparable<T> { compareTo(other: T): number; } interface I<T> { x: Comparable<T>; } interface K<T> { x: A<T>; } class A<T> implements Comparable<T> { compareTo(other: T) { return 1; } } var z = { x: new A<number>() }; var a1: I<string> = { x: new A<number>() }; var a2: I<string> = function (): { x: A<number> } { var z = { x: new A<number>() }; return z; } (); var a3: I<string> = z; var a4: I<string> = <K<number>>z;
{ "end_byte": 444, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts" }
TypeScript/tests/cases/compiler/collisionThisExpressionAndClassInGlobal.ts_0_35
class _this { } var f = () => this;
{ "end_byte": 35, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionThisExpressionAndClassInGlobal.ts" }
TypeScript/tests/cases/compiler/genericCloneReturnTypes2.ts_0_420
class MyList<T> { public size: number; public data: T[]; constructor(n: number) { this.size = n; this.data = new Array<T>(this.size); } public clone() { return new MyList<T>(this.size); } } var a: MyList<string>; var b: MyList<any> = a.clone(); // ok var c: MyList<string> = a.clone(); // bug was there was an error on this line var d: MyList<number> = a.clone(); // error
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericCloneReturnTypes2.ts" }
TypeScript/tests/cases/compiler/trailingCommasES5.ts_0_201
// @target: es5 var o1 = { a: 1, b: 2 }; var o2 = { a: 1, b: 2, }; var o3 = { a: 1, }; var o4 = {}; var a1 = [1, 2]; var a2 = [1, 2, ]; var a3 = [1, ]; var a4 = []; var a5 = [1, , ]; var a6 = [, , ];
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/trailingCommasES5.ts" }
TypeScript/tests/cases/compiler/grammarAmbiguities1.ts_0_172
class A { foo() { } } class B { bar() { }} function f(x) { return x; } function g<T, U>(x) { return f(x); } g<A, B>(7) f(g<A, B>(7)); f(g < A, B > 7); f(g < A, B > +(7));
{ "end_byte": 172, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/grammarAmbiguities1.ts" }
TypeScript/tests/cases/compiler/computerPropertiesInES5ShouldBeTransformed.ts_0_60
// @target: es5 const b = ({ [`key`]: renamed }) => renamed;
{ "end_byte": 60, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/computerPropertiesInES5ShouldBeTransformed.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationInDependency2.ts_0_112
// @filename: /node_modules/A/index.ts declare module "ext" { } export {}; // @filename: /src/app.ts import "A"
{ "end_byte": 112, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationInDependency2.ts" }
TypeScript/tests/cases/compiler/es6ImportNamedImportDts.ts_0_1214
// @module: commonjs // @declaration: true // @filename: server.ts export class a { } export class a11 { } export class a12 { } export class x { } export class x11 { } export class m { } export class a1 { } export class x1 { } export class a111 { } export class x111 { } export class z1 { } export class z2 { } export class aaaa { } export class aaaa1 { } // @filename: client.ts import { } from "./server"; import { a } from "./server"; export var xxxx = new a(); import { a11 as b } from "./server"; export var xxxx1 = new b(); import { x, a12 as y } from "./server"; export var xxxx2 = new x(); export var xxxx3 = new y(); import { x11 as z, } from "./server"; export var xxxx4 = new z(); import { m, } from "./server"; export var xxxx5 = new m(); import { a1, x1 } from "./server"; export var xxxx6 = new a1(); export var xxxx7 = new x1(); import { a111 as a11, x111 as x11 } from "./server"; export var xxxx8 = new a11(); export var xxxx9 = new x11(); import { z1 } from "./server"; export var z111 = new z1(); import { z2 as z3 } from "./server"; export var z2 = new z3(); // z2 shouldn't give redeclare error // not referenced import { aaaa } from "./server"; import { aaaa1 as bbbb } from "./server";
{ "end_byte": 1214, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportNamedImportDts.ts" }
TypeScript/tests/cases/compiler/importNonExportedMember.ts_0_156
// @filename: a.ts declare function foo(): any declare function bar(): any; export { foo, bar as baz }; // @filename: b.ts import { foo, bar } from "./a";
{ "end_byte": 156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importNonExportedMember.ts" }