_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/compiler/declarationEmitInferredTypeAlias2.ts_3_244
@declaration: true // @skipDefaultLibCheck: true // @Filename: 0.ts { type Data = string | boolean; let obj: Data = true; } export { } // @Filename: 1.ts let v = "str" || true; function bar () { return v; } export { v, bar }
{ "end_byte": 244, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitInferredTypeAlias2.ts" }
TypeScript/tests/cases/compiler/objectLiteralThisWidenedOnUse.ts_0_228
// @noImplicitThis: true interface Foo { bar: boolean; } var GlobalIns = { prop1: 1, prop2: 2, prop3: 3, test () { this.accept_foo(this); }, accept_foo (foo: Foo): boolean { return !!foo && !!foo.bar; } };
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectLiteralThisWidenedOnUse.ts" }
TypeScript/tests/cases/compiler/noImplicitAnyUnionNormalizedObjectLiteral1.ts_0_388
// @strictNullChecks: false // @noImplicitAny: true // @noEmit: true // https://github.com/microsoft/TypeScript/issues/58150 function doSthWithParams(params: unknown) { if (typeof params !== "object") { return {}; } return { c: "foo", p: "bar", s: "baz", }; } const bar = { p: null, s: null, ...doSthWithParams({ p: "hello", s: "world", }), };
{ "end_byte": 388, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noImplicitAnyUnionNormalizedObjectLiteral1.ts" }
TypeScript/tests/cases/compiler/inheritance.ts_0_414
class B1 { public x; } class B2 { public x; } class D1 extends B1 { } class D2 extends B2 { } class N { public y:number; } class ND extends N { // any is assignable to number public y; } class Good { public f: () => number = function () { return 0; } public g() { return 0; } } class Baad extends Good { public f(): number { return 0; } public g(n: number) { return 0; } }
{ "end_byte": 414, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inheritance.ts" }
TypeScript/tests/cases/compiler/yieldExpressionInFlowLoop.ts_0_128
// @noImplicitAny: true // @target: es6 function* f() { let result; while (1) { result = yield result; } }
{ "end_byte": 128, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/yieldExpressionInFlowLoop.ts" }
TypeScript/tests/cases/compiler/moduleAugmentationExtendFileModule2.ts_0_740
// @module: commonjs // @filename: map.ts import { Observable } from "./observable" (<any>Observable.prototype).map = function() { } declare module "./observable" { interface Observable<T> { map<U>(proj: (e:T) => U): Observable<U> } namespace Observable { let someAnotherValue: string; } } // @filename: observable.ts export declare class Observable<T> { filter(pred: (e:T) => boolean): Observable<T>; } export namespace Observable { export let someValue: number; } // @filename: main.ts import { Observable } from "./observable" import "./map"; let x: Observable<number>; let y = x.map(x => x + 1); let z1 = Observable.someValue.toFixed(); let z2 = Observable.someAnotherValue.toLowerCase();
{ "end_byte": 740, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleAugmentationExtendFileModule2.ts" }
TypeScript/tests/cases/compiler/badExternalModuleReference.ts_0_129
//@module: amd import a1 = require("garbage"); export declare var a: { test1: a1.connectModule; (): a1.connectExport; };
{ "end_byte": 129, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/badExternalModuleReference.ts" }
TypeScript/tests/cases/compiler/partialOfLargeAPIIsAbleToBeWorkedWith.ts_0_1764
// @strict: true interface MyAPI { 0: (x: 0) => string; 1: (x: 1) => string; 2: (x: 2) => string; 3: (x: 3) => string; 4: (x: 4) => string; 5: (x: 5) => string; 6: (x: 6) => string; 7: (x: 7) => string; 8: (x: 8) => string; 9: (x: 9) => string; 10: (x: 10) => string; 11: (x: 11) => string; 12: (x: 12) => string; 13: (x: 13) => string; 14: (x: 14) => string; 15: (x: 15) => string; 16: (x: 16) => string; 17: (x: 17) => string; 18: (x: 18) => string; 19: (x: 19) => string; 20: (x: 20) => string; 21: (x: 21) => string; 22: (x: 22) => string; 23: (x: 23) => string; 24: (x: 24) => string; 25: (x: 25) => string; 26: (x: 26) => string; 27: (x: 27) => string; 28: (x: 28) => string; 29: (x: 29) => string; 30: (x: 30) => string; 31: (x: 31) => string; 32: (x: 32) => string; 33: (x: 33) => string; 34: (x: 34) => string; 35: (x: 35) => string; 36: (x: 36) => string; 37: (x: 37) => string; 38: (x: 38) => string; 39: (x: 39) => string; 40: (x: 40) => string; 41: (x: 41) => string; 42: (x: 42) => string; 43: (x: 43) => string; 44: (x: 44) => string; 45: (x: 45) => string; 46: (x: 46) => string; 47: (x: 47) => string; 48: (x: 48) => string; 49: (x: 49) => string; 50: (x: 50) => string; 51: (x: 51) => string; } const obj: Partial<MyAPI> = {}; declare var keys: (keyof MyAPI)[]; for (const k of keys) { obj[k] = () => "12"; // shouldn't cause a complexity error } type PartialNull<T> = {[K in keyof T]?: T[K] | null}; const obj2: PartialNull<MyAPI> = {}; for (const k of keys) { obj2[k] = () => "12"; // shouldn't cause a complexity error }
{ "end_byte": 1764, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/partialOfLargeAPIIsAbleToBeWorkedWith.ts" }
TypeScript/tests/cases/compiler/noExcessiveStackDepthError.ts_0_360
// @strict: true // @declaration: true // Repro from #46631 interface FindOperator<T> { foo: T; } type FindConditions<T> = { [P in keyof T]?: FindConditions<T[P]> | FindOperator<FindConditions<T[P]>>; }; function foo<Entity>() { var x: FindConditions<any>; var x: FindConditions<Entity>; // Excessive stack depth error not expected here }
{ "end_byte": 360, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noExcessiveStackDepthError.ts" }
TypeScript/tests/cases/compiler/genericReversingTypeParameters.ts_0_291
class BiMap<K, V> { private inverseBiMap: BiMap<V, K>; public get(key: K): V { return null; } public inverse(): BiMap<V, K> { return null; } } var b = new BiMap<string, number>(); var r1 = b.get(''); var i = b.inverse(); // used to get the type wrong here. var r2b = i.get(1);
{ "end_byte": 291, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericReversingTypeParameters.ts" }
TypeScript/tests/cases/compiler/thisInObjectJs.ts_0_260
// @allowJs: true // @outDir: out // @filename: index.js export { } let obj = { x: 10, y: [1], fun: function() { this.x = 1 this/*1*/ }, f2: function() { this.x this/*2*/ }, f3: (function() { this.x = 1 this/*3*/ }), }
{ "end_byte": 260, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/thisInObjectJs.ts" }
TypeScript/tests/cases/compiler/restUnion.ts_0_324
var union: { a: number, c: boolean } | { a: string, b: string }; var rest1: { c: boolean } | { b: string }; var {a, ...rest1 } = union; var undefinedUnion: { n: number } | undefined; var rest2: {}; var {n, ...rest2 } = undefinedUnion; var nullUnion: { n: number } | null; var rest3: {}; var {n, ...rest3 } = nullUnion;
{ "end_byte": 324, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/restUnion.ts" }
TypeScript/tests/cases/compiler/cachedModuleResolution2.ts_0_232
// @moduleResolution: node // @traceResolution: true // @filename: /a/b/node_modules/foo.d.ts export declare let x: number // @filename: /a/b/c/lib.ts import {x} from "foo"; // @filename: /a/b/c/d/e/app.ts import {x} from "foo";
{ "end_byte": 232, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/cachedModuleResolution2.ts" }
TypeScript/tests/cases/compiler/destructuringInVariableDeclarations8.ts_0_97
// @target: es6 // @module: system let { toString } = 1; { let { toFixed } = 1; } export {};
{ "end_byte": 97, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/destructuringInVariableDeclarations8.ts" }
TypeScript/tests/cases/compiler/exportDefaultWithJSDoc1.ts_1_264
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: a.js /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike */ /** @type {NumberLike[]} */export default ([ ]); // @Filename: b.ts import A from './a' A[0]
{ "end_byte": 264, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportDefaultWithJSDoc1.ts" }
TypeScript/tests/cases/compiler/jsxChildWrongType.tsx_0_323
// @jsx: react // @strict: true // @target: ES2017 // @module: ESNext // @esModuleInterop: true // @skipLibCheck: true // @filename: index.tsx /// <reference path="/.lib/react18/react18.d.ts" /> /// <reference path="/.lib/react18/global.d.ts" /> const a = ( <main> {(<div />) as unknown} <span /> </main> );
{ "end_byte": 323, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsxChildWrongType.tsx" }
TypeScript/tests/cases/compiler/jsFileCompilationClassMethodContainingArrowFunction.ts_0_129
// @allowJs: true // @outFile: out.js // @FileName: a.js class c { method(a) { let x = a => this.method(a); } }
{ "end_byte": 129, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationClassMethodContainingArrowFunction.ts" }
TypeScript/tests/cases/compiler/partiallyDiscriminantedUnions.ts_0_657
// Repro from #10586 interface A1 { type: 'a'; subtype: 1; } interface A2 { type: 'a'; subtype: 2; foo: number; } interface B { type: 'b'; } type AB = A1 | A2 | B; const ab: AB = <AB>{}; if (ab.type === 'a') { if (ab.subtype === 2) { ab.foo; } } // Repro from #11185 class Square { kind: "square"; } class Circle { kind: "circle"; } type Shape = Circle | Square; type Shapes = Shape | Array<Shape>; function isShape(s : Shapes): s is Shape { return !Array.isArray(s); } function fail(s: Shapes) { if (isShape(s)) { if (s.kind === "circle") { let c: Circle = s; } } }
{ "end_byte": 657, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/partiallyDiscriminantedUnions.ts" }
TypeScript/tests/cases/compiler/checkSwitchStatementIfCaseTypeIsString.ts_0_206
declare function use(a: any): void; class A { doIt(x: Array<string>): void { x.forEach((v) => { switch(v) { case "test": use(this); } }); } }
{ "end_byte": 206, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/checkSwitchStatementIfCaseTypeIsString.ts" }
TypeScript/tests/cases/compiler/genericCombinators2.ts_0_540
interface Collection<T, U> { length: number; add(x: T, y: U): void; remove(x: T, y: U): boolean; } interface Combinators { map<T, U>(c: Collection<T, U>, f: (x: T, y: U) => any): Collection<any, any>; map<T, U, V>(c: Collection<T, U>, f: (x: T, y: U) => V): Collection<T, V>; } var _: Combinators; var c2: Collection<number, string>; var rf1 = (x: number, y: string) => { return x.toFixed() }; var r5a = _.map<number, string, Date>(c2, (x, y) => { return x.toFixed() }); var r5b = _.map<number, string, Date>(c2, rf1);
{ "end_byte": 540, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericCombinators2.ts" }
TypeScript/tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts_0_562
//@noimplicitany: true declare function foo(x); // this should be an error declare var bar; // this should be be an erro declare class C { public publicMember; // this should be an error private privateMember; // this should not be an error public publicFunction(x); // this should be an error private privateFunction(privateParam); // this should not be an error private constructor(privateParam); // this should not be an error } declare class D { public constructor(publicConsParam, int: number); // this should be an error }
{ "end_byte": 562, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts" }
TypeScript/tests/cases/compiler/argumentsReferenceInMethod2_Js.ts_0_217
// @declaration: true // @allowJs: true // @emitDeclarationOnly: true // @filename: /a.js class A { /** * @param {object} [foo={}] */ m(foo = {}) { /** * @type object */ this["arguments"] = foo; } }
{ "end_byte": 217, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/argumentsReferenceInMethod2_Js.ts" }
TypeScript/tests/cases/compiler/assignmentCompatability8.ts_0_440
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 classWithPublic<T> { constructor(public one: T) {} } var x1 = new classWithPublic(1);; export var __val__x1 = x1; } __test2__.__val__x1 = __test1__.__val__obj4
{ "end_byte": 440, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/assignmentCompatability8.ts" }
TypeScript/tests/cases/compiler/genericWithIndexerOfTypeParameterType1.ts_0_236
class LazyArray<T> { private objects = <{ [objectId: string]: T; }>{}; array() { return this.objects; } } var lazyArray = new LazyArray<string>(); var value: string = lazyArray.array()["test"]; // used to be an error
{ "end_byte": 236, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericWithIndexerOfTypeParameterType1.ts" }
TypeScript/tests/cases/compiler/moduleResolutionWithRequire.ts_0_262
// @traceResolution: true // @filename: /other.ts export const other = 123; // @filename: /index.ts declare const require: any; function foo() { const a = require('../outside-of-rootdir/foo'); const { other }: { other: string } = require('./other'); }
{ "end_byte": 262, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionWithRequire.ts" }
TypeScript/tests/cases/compiler/unusedTypeParameters7.ts_0_129
//@noUnusedLocals:true //@noUnusedParameters:true // @fileName: a.ts class C<T> { a: T; } // @fileName: b.ts interface C<T> { }
{ "end_byte": 129, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedTypeParameters7.ts" }
TypeScript/tests/cases/compiler/decoratorMetadataTypeOnlyImport.ts_0_292
// @experimentalDecorators: true // @emitDecoratorMetadata: true // @filename: ./a.ts import { List } from 'unknown-module'; export type MyList = List<number>; // @filename: ./b.ts import { type MyList } from './a'; declare var Decorator: any; class Foo { @Decorator myList?: MyList; }
{ "end_byte": 292, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/decoratorMetadataTypeOnlyImport.ts" }
TypeScript/tests/cases/compiler/isolatedModulesShadowGlobalTypeNotValue.ts_0_1191
// @isolatedModules: false, true // @verbatimModuleSyntax: false, true // @noEmit: true // @noTypesAndSymbols: true // @filename: ./types.ts export interface Date { day: number; month: number; year: number; } export namespace Event { export type T = any; } // @filename: ./node.d.ts declare module 'node:console' { global { interface Console { Console: console.ConsoleConstructor; } namespace console { interface ConsoleConstructor { prototype: Console; new (): Console; } } var console: Console; } export = globalThis.console; } // @filename: ./bad.ts import { Date, Event } from './types'; function foo(a: Date) { const b = new Date(a.year, a.month, a.day); return b.getTime(); } function bar() { return new Event('bar') as Event.T; } // @filename: ./good.ts import type { Date, Event } from './types'; import { Console } from 'node:console'; function foo(a: Date) { const b = new Date(a.year, a.month, a.day); return b.getTime(); } function bar() { return new Event('bar') as Event.T; } const baz: Console = new Console();
{ "end_byte": 1191, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isolatedModulesShadowGlobalTypeNotValue.ts" }
TypeScript/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapesES6.ts_0_64
//@target: es6 function f(...args: any[]) { } f `\t\n\v\f\r\\`;
{ "end_byte": 64, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapesES6.ts" }
TypeScript/tests/cases/compiler/unusedClassesinNamespace5.ts_0_171
//@noUnusedLocals:true //@noUnusedParameters:true namespace Validation { class c1 { } export class c2 { } class c3 { public x: c1; } }
{ "end_byte": 171, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedClassesinNamespace5.ts" }
TypeScript/tests/cases/compiler/expr.ts_0_2017
interface I { } enum E { Red, Green, Blue } function f() { var a: any; var n=3; var s=""; var b=false; var i:I; var e:E; n&&a; n&&s; n&&b; n&&i; n&&n; n&&e; s&&a; s&&n; s&&b; s&&i; s&&s; s&&e; a&&n; a&&s; a&&b; a&&i; a&&a; a&&e; i&&n; i&&s; i&&b; i&&a; i&&i; i&&e; e&&n; e&&s; e&&b; e&&a; e&&i; e&&e; n||a; n||s; n||b; n||i; n||n; n||e; s||a; s||n; s||b; s||i; s||s; s||e; a||n; a||s; a||b; a||i; a||a; a||e; i||n; i||s; i||b; i||a; i||i; i||e; e||n; e||s; e||b; e||a; e||i; e||e; n==a; n==s; n==b; n==i; n==n; n==e; s==a; s==n; s==b; s==i; s==s; s==e; a==n; a==s; a==b; a==i; a==a; a==e; i==n; i==s; i==b; i==a; i==i; i==e; e==n; e==s; e==b; e==a; e==i; e==e; +i; +s; +n; +a; +b; -i; -s; -n; -a; -b; !i; !s; !n; !a; !b; n+a; n+s; n+b; n+i; n+n; n+e; s+a; s+n; s+b; s+i; s+s; s+e; a+n; a+s; a+b; a+i; a+a; a+e; i+n; i+s; i+b; i+a; i+i; i+e; e+n; e+s; e+b; e+a; e+i; e+e; n^a; n^s; n^b; n^i; n^n; n^e; s^a; s^n; s^b; s^i; s^s; s^e; a^n; a^s; a^b; a^i; a^a; a^e; i^n; i^s; i^b; i^a; i^i; i^e; e^n; e^s; e^b; e^a; e^i; e^e; n-a; n-s; n-b; n-i; n-n; n-e; s-a; s-n; s-b; s-i; s-s; s-e; a-n; a-s; a-b; a-i; a-a; a-e; i-n; i-s; i-b; i-a; i-i; i-e; e-n; e-s; e-b; e-a; e-i; e-e; }
{ "end_byte": 2017, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/expr.ts" }
TypeScript/tests/cases/compiler/exportEmptyObjectBindingPattern.ts_0_142
// @module: commonjs,amd,system,es2015,esnext // @target: esnext,es5 // @noEmitHelpers: true // @noTypesAndSymbols: true export const {} = {};
{ "end_byte": 142, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/exportEmptyObjectBindingPattern.ts" }
TypeScript/tests/cases/compiler/callOverloads1.ts_0_285
class Foo { // error bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { // WScript.Echo("Constructor function has executed"); } } function Foo(); // error function F1(s:string); function F1(a:any) { return a;} var f1 = new Foo("hey"); f1.bar1(); Foo();
{ "end_byte": 285, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/callOverloads1.ts" }
TypeScript/tests/cases/compiler/collisionRestParameterInterfaceMembers.ts_0_430
// call interface i1 { (_i: number, ...restParameters); // no error - no code gen } interface i1NoError { (_i: number); // no error } // new interface i2 { new (_i: number, ...restParameters); // no error - no code gen } interface i2NoError { new (_i: number); // no error } // method interface i3 { foo (_i: number, ...restParameters); // no error - no code gen fooNoError (_i: number); // no error }
{ "end_byte": 430, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/collisionRestParameterInterfaceMembers.ts" }
TypeScript/tests/cases/compiler/expandoFunctionBlockShadowing.ts_0_428
// @strict: true // @declaration: true // https://github.com/microsoft/TypeScript/issues/56538 export function X() {} if (Math.random()) { const X: { test?: any } = {}; X.test = 1; } export function Y() {} Y.test = "foo"; const aliasTopY = Y; if (Math.random()) { const Y = function Y() {} Y.test = 42; const topYcheck: { (): void; test: string } = aliasTopY; const blockYcheck: { (): void; test: number } = Y; }
{ "end_byte": 428, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/expandoFunctionBlockShadowing.ts" }
TypeScript/tests/cases/compiler/requireEmitSemicolon.ts_0_514
//@module: amd // @Filename: requireEmitSemicolon_0.ts export module Models { export class Person { constructor(name: string) { } } } // @Filename: requireEmitSemicolon_1.ts ///<reference path='requireEmitSemicolon_0.ts'/> import P = require("requireEmitSemicolon_0"); // bug was we were not emitting a ; here and causing runtime failures in node export module Database { export class DB { public findPerson(id: number): P.Models.Person { return new P.Models.Person("Rock"); } } }
{ "end_byte": 514, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireEmitSemicolon.ts" }
TypeScript/tests/cases/compiler/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithNoOut.ts_0_228
// @allowJs: true // @declaration: true // @filename: a.ts class c { } // @filename: b.ts /// <reference path="c.js"/> // b.d.ts should have c.d.ts as the reference path function foo() { } // @filename: c.js function bar() { }
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithNoOut.ts" }
TypeScript/tests/cases/compiler/complexNarrowingWithAny.ts_0_5044
// Repro from #10869 /** * This file is generated by the Angular 2 template compiler. * Do not edit. */ /* tslint:disable */ // import * as import0 from '@angular/core/src/linker/ng_module_factory'; // import * as import1 from '../../app'; // import * as import2 from '@angular/common/src/common_module'; // import * as import3 from '@angular/core/src/application_module'; // import * as import4 from '@angular/platform-browser/src/browser'; // import * as import5 from '@angular/forms/src/directives'; // import * as import6 from '@angular/forms/src/form_providers'; // import * as import7 from '@angular/common/src/localization'; // import * as import8 from '@angular/core/src/application_init'; // import * as import9 from '@angular/core/src/testability/testability'; // import * as import10 from '@angular/core/src/application_ref'; // import * as import11 from '@angular/core/src/linker/compiler'; // import * as import12 from '@angular/platform-browser/src/dom/events/hammer_gestures'; // import * as import13 from '@angular/platform-browser/src/dom/events/event_manager'; // import * as import14 from '@angular/platform-browser/src/dom/shared_styles_host'; // import * as import15 from '@angular/platform-browser/src/dom/dom_renderer'; // import * as import16 from '@angular/platform-browser/src/security/dom_sanitization_service'; // import * as import17 from '@angular/core/src/linker/view_utils'; // import * as import18 from '@angular/forms/src/form_builder'; // import * as import19 from '@angular/forms/src/directives/radio_control_value_accessor'; // import * as import20 from '@angular/core/src/di/injector'; // import * as import21 from '@angular/core/src/application_tokens'; // import * as import22 from '@angular/platform-browser/src/dom/events/dom_events'; // import * as import23 from '@angular/platform-browser/src/dom/events/key_events'; // import * as import24 from '@angular/core/src/zone/ng_zone'; // import * as import25 from '@angular/platform-browser/src/dom/debug/ng_probe'; // import * as import26 from '@angular/core/src/console'; // import * as import27 from '@angular/core/src/i18n/tokens'; // import * as import28 from '@angular/core/src/error_handler'; // import * as import29 from '@angular/platform-browser/src/dom/dom_tokens'; // import * as import30 from '@angular/platform-browser/src/dom/animation_driver'; // import * as import31 from '@angular/core/src/render/api'; // import * as import32 from '@angular/core/src/security'; // import * as import33 from '@angular/core/src/change_detection/differs/iterable_differs'; // import * as import34 from '@angular/core/src/change_detection/differs/keyvalue_differs'; // import * as import35 from '@angular/core/src/i18n/tokens'; // import * as import36 from '@angular/core/src/render/api'; // import * as import37 from '@angular/core/src/linker/view'; // import * as import38 from '@angular/core/src/linker/element'; // import * as import39 from '@angular/core/src/linker/view_utils'; // import * as import40 from '@angular/core/src/linker/view_type'; // import * as import41 from '@angular/core/src/change_detection/change_detection'; // import * as import42 from '@angular/core/src/metadata/view'; // import * as import43 from '@angular/core/src/linker/component_factory'; // import * as import44 from '@angular/forms/src/directives/reactive_directives/form_group_directive'; // import * as import45 from '@angular/forms/src/directives/ng_control_status'; // import * as import46 from '@angular/forms/src/directives/default_value_accessor'; // import * as import47 from '@angular/forms/src/directives/reactive_directives/form_control_name'; // import * as import48 from '@angular/core/src/linker/element_ref'; // import * as import49 from '@angular/forms/src/directives/control_value_accessor'; // import * as import50 from '@angular/forms/src/directives/ng_control'; // import * as import51 from '@angular/forms/src/directives/control_container'; //stubbed out imports namespace import44 { export class FormGroupDirective { constructor(any){} } } namespace import45 { export class NgControlStatus { constructor(any){} } export class NgControlStatusGroup { constructor(any){} } } namespace import46 { export class DefaultValueAccessor { constructor(any){} } } namespace import47 { export class FormControlName { constructor(any){} } } namespace import48 { export class FormControlName { constructor(any){} } } //HERE BE DRAGONS //Using a value here - 65+ seconds to typecheck namespace import49 { //real code uses an opaque token, using new String() to simulate. //export var NG_VALUE_ACCESSOR = new OpaqueToken('ngValueAccessor') export var NG_VALUE_ACCESSOR = new String('foo') } //using a class - < 1 sec typecheck // namespace import49 { // export class NG_VALUE_ACCESSOR { // constructor(any){} // } // } //END DRAGONS namespace import50 { export class NgControl { constructor(any){} } } namespace import51 { export class ControlContainer { constructor(any){} } } class _View_AppComponent0
{ "end_byte": 5044, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexNarrowingWithAny.ts" }
TypeScript/tests/cases/compiler/complexNarrowingWithAny.ts_5045_10670
{ _text_0:any; _el_1:any; _FormGroupDirective_1_3:import44.FormGroupDirective; _ControlContainer_1_4:any; _NgControlStatusGroup_1_5:import45.NgControlStatusGroup; _text_2:any; _el_3:any; _DefaultValueAccessor_3_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_3_4:any[]; _FormControlName_3_5:import47.FormControlName; _NgControl_3_6:any; _NgControlStatus_3_7:import45.NgControlStatus; _el_4:any; _text_5:any; _el_6:any; _DefaultValueAccessor_6_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_6_4:any[]; _FormControlName_6_5:import47.FormControlName; _NgControl_6_6:any; _NgControlStatus_6_7:import45.NgControlStatus; _el_7:any; _text_8:any; _el_9:any; _DefaultValueAccessor_9_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_9_4:any[]; _FormControlName_9_5:import47.FormControlName; _NgControl_9_6:any; _NgControlStatus_9_7:import45.NgControlStatus; _el_10:any; _text_11:any; _el_12:any; _DefaultValueAccessor_12_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_12_4:any[]; _FormControlName_12_5:import47.FormControlName; _NgControl_12_6:any; _NgControlStatus_12_7:import45.NgControlStatus; _el_13:any; _text_14:any; _el_15:any; _DefaultValueAccessor_15_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_15_4:any[]; _FormControlName_15_5:import47.FormControlName; _NgControl_15_6:any; _NgControlStatus_15_7:import45.NgControlStatus; _el_16:any; _text_17:any; _el_18:any; _DefaultValueAccessor_18_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_18_4:any[]; _FormControlName_18_5:import47.FormControlName; _NgControl_18_6:any; _NgControlStatus_18_7:import45.NgControlStatus; _el_19:any; _text_20:any; _el_21:any; _DefaultValueAccessor_21_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_21_4:any[]; _FormControlName_21_5:import47.FormControlName; _NgControl_21_6:any; _NgControlStatus_21_7:import45.NgControlStatus; _el_22:any; _text_23:any; _el_24:any; _DefaultValueAccessor_24_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_24_4:any[]; _FormControlName_24_5:import47.FormControlName; _NgControl_24_6:any; _NgControlStatus_24_7:import45.NgControlStatus; _el_25:any; _text_26:any; _el_27:any; _DefaultValueAccessor_27_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_27_4:any[]; _FormControlName_27_5:import47.FormControlName; _NgControl_27_6:any; _NgControlStatus_27_7:import45.NgControlStatus; _el_28:any; _text_29:any; _el_30:any; _DefaultValueAccessor_30_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_30_4:any[]; _FormControlName_30_5:import47.FormControlName; _NgControl_30_6:any; _NgControlStatus_30_7:import45.NgControlStatus; _el_31:any; _text_32:any; _el_33:any; _DefaultValueAccessor_33_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_33_4:any[]; _FormControlName_33_5:import47.FormControlName; _NgControl_33_6:any; _NgControlStatus_33_7:import45.NgControlStatus; _el_34:any; _text_35:any; _el_36:any; _DefaultValueAccessor_36_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_36_4:any[]; _FormControlName_36_5:import47.FormControlName; _NgControl_36_6:any; _NgControlStatus_36_7:import45.NgControlStatus; _el_37:any; _text_38:any; _el_39:any; _DefaultValueAccessor_39_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_39_4:any[]; _FormControlName_39_5:import47.FormControlName; _NgControl_39_6:any; _NgControlStatus_39_7:import45.NgControlStatus; _el_40:any; _text_41:any; _el_42:any; _DefaultValueAccessor_42_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_42_4:any[]; _FormControlName_42_5:import47.FormControlName; _NgControl_42_6:any; _NgControlStatus_42_7:import45.NgControlStatus; _el_43:any; _text_44:any; _el_45:any; _DefaultValueAccessor_45_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_45_4:any[]; _FormControlName_45_5:import47.FormControlName; _NgControl_45_6:any; _NgControlStatus_45_7:import45.NgControlStatus; _el_46:any; _text_47:any; _el_48:any; _DefaultValueAccessor_48_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_48_4:any[]; _FormControlName_48_5:import47.FormControlName; _NgControl_48_6:any; _NgControlStatus_48_7:import45.NgControlStatus; _el_49:any; _text_50:any; _el_51:any; _DefaultValueAccessor_51_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_51_4:any[]; _FormControlName_51_5:import47.FormControlName; _NgControl_51_6:any; _NgControlStatus_51_7:import45.NgControlStatus; _el_52:any; _text_53:any; _el_54:any; _DefaultValueAccessor_54_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_54_4:any[]; _FormControlName_54_5:import47.FormControlName; _NgControl_54_6:any; _NgControlStatus_54_7:import45.NgControlStatus; _el_55:any; _text_56:any; _el_57:any; _DefaultValueAccessor_57_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_57_4:any[]; _FormControlName_57_5:import47.FormControlName; _NgControl_57_6:any; _NgControlStatus_57_7:import45.NgControlStatus; _el_58:any; _text_59:any; _el_60:any; _DefaultValueAccessor_60_3:import46.DefaultValueAccessor; _NG_VALUE_ACCESSOR_60_4:any[]; _FormControlName_60_5:import47.FormControlName; _NgControl_60_6:any; _NgControlStatus_60_7:import45.NgControlStatus; _el_61:any; _text_62:any; _text_63:any; /*private*/ _expr_2:any; /*private*/ _expr_3:any; /*private*/ _expr_4:any; /*private*/ _expr_5:any; /*private*/ _expr_6:any; /*private*/ _expr_7:any; /*private*/ _expr_8:any; /*private*/ _expr_11:any; /*private*/ _expr_12:any
{ "end_byte": 10670, "start_byte": 5045, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexNarrowingWithAny.ts" }
TypeScript/tests/cases/compiler/complexNarrowingWithAny.ts_10670_14677
; /*private*/ _expr_13:any; /*private*/ _expr_14:any; /*private*/ _expr_15:any; /*private*/ _expr_16:any; /*private*/ _expr_17:any; /*private*/ _expr_20:any; /*private*/ _expr_21:any; /*private*/ _expr_22:any; /*private*/ _expr_23:any; /*private*/ _expr_24:any; /*private*/ _expr_25:any; /*private*/ _expr_26:any; /*private*/ _expr_29:any; /*private*/ _expr_30:any; /*private*/ _expr_31:any; /*private*/ _expr_32:any; /*private*/ _expr_33:any; /*private*/ _expr_34:any; /*private*/ _expr_35:any; /*private*/ _expr_38:any; /*private*/ _expr_39:any; /*private*/ _expr_40:any; /*private*/ _expr_41:any; /*private*/ _expr_42:any; /*private*/ _expr_43:any; /*private*/ _expr_44:any; /*private*/ _expr_47:any; /*private*/ _expr_48:any; /*private*/ _expr_49:any; /*private*/ _expr_50:any; /*private*/ _expr_51:any; /*private*/ _expr_52:any; /*private*/ _expr_53:any; /*private*/ _expr_56:any; /*private*/ _expr_57:any; /*private*/ _expr_58:any; /*private*/ _expr_59:any; /*private*/ _expr_60:any; /*private*/ _expr_61:any; /*private*/ _expr_62:any; /*private*/ _expr_65:any; /*private*/ _expr_66:any; /*private*/ _expr_67:any; /*private*/ _expr_68:any; /*private*/ _expr_69:any; /*private*/ _expr_70:any; /*private*/ _expr_71:any; /*private*/ _expr_74:any; /*private*/ _expr_75:any; /*private*/ _expr_76:any; /*private*/ _expr_77:any; /*private*/ _expr_78:any; /*private*/ _expr_79:any; /*private*/ _expr_80:any; /*private*/ _expr_83:any; /*private*/ _expr_84:any; /*private*/ _expr_85:any; /*private*/ _expr_86:any; /*private*/ _expr_87:any; /*private*/ _expr_88:any; /*private*/ _expr_89:any; /*private*/ _expr_92:any; /*private*/ _expr_93:any; /*private*/ _expr_94:any; /*private*/ _expr_95:any; /*private*/ _expr_96:any; /*private*/ _expr_97:any; /*private*/ _expr_98:any; /*private*/ _expr_101:any; /*private*/ _expr_102:any; /*private*/ _expr_103:any; /*private*/ _expr_104:any; /*private*/ _expr_105:any; /*private*/ _expr_106:any; /*private*/ _expr_107:any; /*private*/ _expr_110:any; /*private*/ _expr_111:any; /*private*/ _expr_112:any; /*private*/ _expr_113:any; /*private*/ _expr_114:any; /*private*/ _expr_115:any; /*private*/ _expr_116:any; /*private*/ _expr_119:any; /*private*/ _expr_120:any; /*private*/ _expr_121:any; /*private*/ _expr_122:any; /*private*/ _expr_123:any; /*private*/ _expr_124:any; /*private*/ _expr_125:any; /*private*/ _expr_128:any; /*private*/ _expr_129:any; /*private*/ _expr_130:any; /*private*/ _expr_131:any; /*private*/ _expr_132:any; /*private*/ _expr_133:any; /*private*/ _expr_134:any; /*private*/ _expr_137:any; /*private*/ _expr_138:any; /*private*/ _expr_139:any; /*private*/ _expr_140:any; /*private*/ _expr_141:any; /*private*/ _expr_142:any; /*private*/ _expr_143:any; /*private*/ _expr_146:any; /*private*/ _expr_147:any; /*private*/ _expr_148:any; /*private*/ _expr_149:any; /*private*/ _expr_150:any; /*private*/ _expr_151:any; /*private*/ _expr_152:any; /*private*/ _expr_155:any; /*private*/ _expr_156:any; /*private*/ _expr_157:any; /*private*/ _expr_158:any; /*private*/ _expr_159:any; /*private*/ _expr_160:any; /*private*/ _expr_161:any; /*private*/ _expr_164:any; /*private*/ _expr_165:any; /*private*/ _expr_166:any; /*private*/ _expr_167:any; /*private*/ _expr_168:any; /*private*/ _expr_169:any; /*private*/ _expr_170:any; /*private*/ _expr_173:any; /*private*/ _expr_174:any; /*private*/ _expr_175:any; /*private*/ _expr_176:any; /*private*/ _expr_177:any; /*private*/ _expr_178:any; /*private*/ _expr_179:any; /*private*/ _expr_182:any; /*private*/ _expr_183:any; /*private*/ _expr_184:any; /*private*/ _expr_185:any; /*private*/ _expr_186:any; /*private*/ _expr_187:any; /*private*/ _expr_188:any; constructor(viewUtils:any,parentInjector:any,declarationEl:any) { }
{ "end_byte": 14677, "start_byte": 10670, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexNarrowingWithAny.ts" }
TypeScript/tests/cases/compiler/complexNarrowingWithAny.ts_14681_21714
injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any { if (((token === import46.DefaultValueAccessor) && (3 === requestNodeIndex))) { return this._DefaultValueAccessor_3_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (3 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_3_4; } if (((token === import47.FormControlName) && (3 === requestNodeIndex))) { return this._FormControlName_3_5; } if (((token === import50.NgControl) && (3 === requestNodeIndex))) { return this._NgControl_3_6; } if (((token === import45.NgControlStatus) && (3 === requestNodeIndex))) { return this._NgControlStatus_3_7; } if (((token === import46.DefaultValueAccessor) && (6 === requestNodeIndex))) { return this._DefaultValueAccessor_6_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (6 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_6_4; } if (((token === import47.FormControlName) && (6 === requestNodeIndex))) { return this._FormControlName_6_5; } if (((token === import50.NgControl) && (6 === requestNodeIndex))) { return this._NgControl_6_6; } if (((token === import45.NgControlStatus) && (6 === requestNodeIndex))) { return this._NgControlStatus_6_7; } if (((token === import46.DefaultValueAccessor) && (9 === requestNodeIndex))) { return this._DefaultValueAccessor_9_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (9 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_9_4; } if (((token === import47.FormControlName) && (9 === requestNodeIndex))) { return this._FormControlName_9_5; } if (((token === import50.NgControl) && (9 === requestNodeIndex))) { return this._NgControl_9_6; } if (((token === import45.NgControlStatus) && (9 === requestNodeIndex))) { return this._NgControlStatus_9_7; } if (((token === import46.DefaultValueAccessor) && (12 === requestNodeIndex))) { return this._DefaultValueAccessor_12_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (12 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_12_4; } if (((token === import47.FormControlName) && (12 === requestNodeIndex))) { return this._FormControlName_12_5; } if (((token === import50.NgControl) && (12 === requestNodeIndex))) { return this._NgControl_12_6; } if (((token === import45.NgControlStatus) && (12 === requestNodeIndex))) { return this._NgControlStatus_12_7; } if (((token === import46.DefaultValueAccessor) && (15 === requestNodeIndex))) { return this._DefaultValueAccessor_15_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (15 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_15_4; } if (((token === import47.FormControlName) && (15 === requestNodeIndex))) { return this._FormControlName_15_5; } if (((token === import50.NgControl) && (15 === requestNodeIndex))) { return this._NgControl_15_6; } if (((token === import45.NgControlStatus) && (15 === requestNodeIndex))) { return this._NgControlStatus_15_7; } if (((token === import46.DefaultValueAccessor) && (18 === requestNodeIndex))) { return this._DefaultValueAccessor_18_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (18 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_18_4; } if (((token === import47.FormControlName) && (18 === requestNodeIndex))) { return this._FormControlName_18_5; } if (((token === import50.NgControl) && (18 === requestNodeIndex))) { return this._NgControl_18_6; } if (((token === import45.NgControlStatus) && (18 === requestNodeIndex))) { return this._NgControlStatus_18_7; } if (((token === import46.DefaultValueAccessor) && (21 === requestNodeIndex))) { return this._DefaultValueAccessor_21_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (21 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_21_4; } if (((token === import47.FormControlName) && (21 === requestNodeIndex))) { return this._FormControlName_21_5; } if (((token === import50.NgControl) && (21 === requestNodeIndex))) { return this._NgControl_21_6; } if (((token === import45.NgControlStatus) && (21 === requestNodeIndex))) { return this._NgControlStatus_21_7; } if (((token === import46.DefaultValueAccessor) && (24 === requestNodeIndex))) { return this._DefaultValueAccessor_24_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (24 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_24_4; } if (((token === import47.FormControlName) && (24 === requestNodeIndex))) { return this._FormControlName_24_5; } if (((token === import50.NgControl) && (24 === requestNodeIndex))) { return this._NgControl_24_6; } if (((token === import45.NgControlStatus) && (24 === requestNodeIndex))) { return this._NgControlStatus_24_7; } if (((token === import46.DefaultValueAccessor) && (27 === requestNodeIndex))) { return this._DefaultValueAccessor_27_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (27 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_27_4; } if (((token === import47.FormControlName) && (27 === requestNodeIndex))) { return this._FormControlName_27_5; } if (((token === import50.NgControl) && (27 === requestNodeIndex))) { return this._NgControl_27_6; } if (((token === import45.NgControlStatus) && (27 === requestNodeIndex))) { return this._NgControlStatus_27_7; } if (((token === import46.DefaultValueAccessor) && (30 === requestNodeIndex))) { return this._DefaultValueAccessor_30_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (30 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_30_4; } if (((token === import47.FormControlName) && (30 === requestNodeIndex))) { return this._FormControlName_30_5; } if (((token === import50.NgControl) && (30 === requestNodeIndex))) { return this._NgControl_30_6; } if (((token === import45.NgControlStatus) && (30 === requestNodeIndex))) { return this._NgControlStatus_30_7; } if (((token === import46.DefaultValueAccessor) && (33 === requestNodeIndex))) { return this._DefaultValueAccessor_33_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (33 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_33_4; } if (((token === import47.FormControlName) && (33 === requestNodeIndex))) { return this._FormControlName_33_5; } if (((token === import50.NgControl) && (33 === requestNodeIndex))) { return this._NgControl_33_6; } if (((token === import45.NgControlStatus) && (33 === requestNodeIndex))) { return this._NgControlStatus_33_7; } if (((token === import46.DefaultValueAccessor) && (36 === requestNodeIndex))) { return this._DefaultValueAccessor_36_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (36 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_36_4; } if (((token === import47.FormControlName) && (36 === requestNodeIndex))) { return this._FormControlName_36_5; } if (((token === import50.NgControl) && (36 === requestNodeIndex))) { return this._NgControl_36_6; } if (((token === import45.NgControlStatus) && (36 === requestNodeIndex))) { return this._NgControlStatus_36_7; }
{ "end_byte": 21714, "start_byte": 14681, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexNarrowingWithAny.ts" }
TypeScript/tests/cases/compiler/complexNarrowingWithAny.ts_21719_27026
if (((token === import46.DefaultValueAccessor) && (39 === requestNodeIndex))) { return this._DefaultValueAccessor_39_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (39 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_39_4; } if (((token === import47.FormControlName) && (39 === requestNodeIndex))) { return this._FormControlName_39_5; } if (((token === import50.NgControl) && (39 === requestNodeIndex))) { return this._NgControl_39_6; } if (((token === import45.NgControlStatus) && (39 === requestNodeIndex))) { return this._NgControlStatus_39_7; } if (((token === import46.DefaultValueAccessor) && (42 === requestNodeIndex))) { return this._DefaultValueAccessor_42_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (42 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_42_4; } if (((token === import47.FormControlName) && (42 === requestNodeIndex))) { return this._FormControlName_42_5; } if (((token === import50.NgControl) && (42 === requestNodeIndex))) { return this._NgControl_42_6; } if (((token === import45.NgControlStatus) && (42 === requestNodeIndex))) { return this._NgControlStatus_42_7; } if (((token === import46.DefaultValueAccessor) && (45 === requestNodeIndex))) { return this._DefaultValueAccessor_45_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (45 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_45_4; } if (((token === import47.FormControlName) && (45 === requestNodeIndex))) { return this._FormControlName_45_5; } if (((token === import50.NgControl) && (45 === requestNodeIndex))) { return this._NgControl_45_6; } if (((token === import45.NgControlStatus) && (45 === requestNodeIndex))) { return this._NgControlStatus_45_7; } if (((token === import46.DefaultValueAccessor) && (48 === requestNodeIndex))) { return this._DefaultValueAccessor_48_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (48 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_48_4; } if (((token === import47.FormControlName) && (48 === requestNodeIndex))) { return this._FormControlName_48_5; } if (((token === import50.NgControl) && (48 === requestNodeIndex))) { return this._NgControl_48_6; } if (((token === import45.NgControlStatus) && (48 === requestNodeIndex))) { return this._NgControlStatus_48_7; } if (((token === import46.DefaultValueAccessor) && (51 === requestNodeIndex))) { return this._DefaultValueAccessor_51_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (51 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_51_4; } if (((token === import47.FormControlName) && (51 === requestNodeIndex))) { return this._FormControlName_51_5; } if (((token === import50.NgControl) && (51 === requestNodeIndex))) { return this._NgControl_51_6; } if (((token === import45.NgControlStatus) && (51 === requestNodeIndex))) { return this._NgControlStatus_51_7; } if (((token === import46.DefaultValueAccessor) && (54 === requestNodeIndex))) { return this._DefaultValueAccessor_54_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (54 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_54_4; } if (((token === import47.FormControlName) && (54 === requestNodeIndex))) { return this._FormControlName_54_5; } if (((token === import50.NgControl) && (54 === requestNodeIndex))) { return this._NgControl_54_6; } if (((token === import45.NgControlStatus) && (54 === requestNodeIndex))) { return this._NgControlStatus_54_7; } if (((token === import46.DefaultValueAccessor) && (57 === requestNodeIndex))) { return this._DefaultValueAccessor_57_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (57 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_57_4; } if (((token === import47.FormControlName) && (57 === requestNodeIndex))) { return this._FormControlName_57_5; } if (((token === import50.NgControl) && (57 === requestNodeIndex))) { return this._NgControl_57_6; } if (((token === import45.NgControlStatus) && (57 === requestNodeIndex))) { return this._NgControlStatus_57_7; } if (((token === import46.DefaultValueAccessor) && (60 === requestNodeIndex))) { return this._DefaultValueAccessor_60_3; } if (((token === import49.NG_VALUE_ACCESSOR) && (60 === requestNodeIndex))) { return this._NG_VALUE_ACCESSOR_60_4; } if (((token === import47.FormControlName) && (60 === requestNodeIndex))) { return this._FormControlName_60_5; } if (((token === import50.NgControl) && (60 === requestNodeIndex))) { return this._NgControl_60_6; } if (((token === import45.NgControlStatus) && (60 === requestNodeIndex))) { return this._NgControlStatus_60_7; } if (((token === import44.FormGroupDirective) && ((1 <= requestNodeIndex) && (requestNodeIndex <= 62)))) { return this._FormGroupDirective_1_3; } if (((token === import51.ControlContainer) && ((1 <= requestNodeIndex) && (requestNodeIndex <= 62)))) { return this._ControlContainer_1_4; } if (((token === import45.NgControlStatusGroup) && ((1 <= requestNodeIndex) && (requestNodeIndex <= 62)))) { return this._NgControlStatusGroup_1_5; } return notFoundResult; } } export function viewFactory_AppComponent0(viewUtils:any,parentInjector:any,declarationEl:any):any { return new _View_AppComponent0(viewUtils,parentInjector,declarationEl); }
{ "end_byte": 27026, "start_byte": 21719, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/complexNarrowingWithAny.ts" }
TypeScript/tests/cases/compiler/jsdocCallbackAndType.ts_0_155
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /a.js /** * @template T * @callback B */ /** @type {B<string>} */ let b; b(); b(1);
{ "end_byte": 155, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/jsdocCallbackAndType.ts" }
TypeScript/tests/cases/compiler/unusedTypeParametersCheckedByNoUnusedParameters.ts_0_149
//@noUnusedParameters:true function f<T>() { } type T<T> = { }; interface I<T> { }; class C<T> { public m<V>() { } }; let l = <T>() => { };
{ "end_byte": 149, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedTypeParametersCheckedByNoUnusedParameters.ts" }
TypeScript/tests/cases/compiler/breakInIterationOrSwitchStatement2.ts_0_29
do { break; } while (true);
{ "end_byte": 29, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/breakInIterationOrSwitchStatement2.ts" }
TypeScript/tests/cases/compiler/enumAssignmentCompat.ts_0_439
module W { export class D { } } enum W { a, b, c, } interface WStatic { a: W; b: W; c: W; } var x: WStatic = W; var y: typeof W = W; var z: number = W; // error var a: number = W.a; var b: typeof W = W.a; // error var c: typeof W.a = W.a; var d: typeof W = 3; // error var e: typeof W.a = 4; var f: WStatic = W.a; // error var g: WStatic = 5; // error var h: W = 3; var i: W = W.a; i = W.a; W.D; var p: W.D;
{ "end_byte": 439, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumAssignmentCompat.ts" }
TypeScript/tests/cases/compiler/moduleDuplicateIdentifiers.ts_0_556
// @module: commonjs export var Foo = 2; export var Foo = 42; // Should error export interface Bar { _brand1: any; } export interface Bar { // Shouldn't error _brand2: any; } export namespace FooBar { export var member1 = 2; } export namespace FooBar { // Shouldn't error export var member2 = 42; } export class Kettle { member1 = 2; } export class Kettle { // Should error member2 = 42; } export var Pot = 2; Pot = 42; // Shouldn't error export enum Utensils { Spoon, Fork, Knife } export enum Utensils { // Shouldn't error Spork = 3 }
{ "end_byte": 556, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleDuplicateIdentifiers.ts" }
TypeScript/tests/cases/compiler/propertyIdentityWithPrivacyMismatch.ts_0_540
//@module: amd // @Filename: propertyIdentityWithPrivacyMismatch_0.ts declare module 'mod1' { class Foo { private n; } } declare module 'mod2' { class Foo { private n; } } // @Filename: propertyIdentityWithPrivacyMismatch_1.ts ///<reference path='propertyIdentityWithPrivacyMismatch_0.ts'/> import m1 = require('mod1'); import m2 = require('mod2'); var x: m1.Foo; var x: m2.Foo; // Should be error (mod1.Foo !== mod2.Foo) class Foo1 { private n; } class Foo2 { private n; } var y: Foo1; var y: Foo2;
{ "end_byte": 540, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/propertyIdentityWithPrivacyMismatch.ts" }
TypeScript/tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts_0_624
// @target: es5 // @lib: es6 // @noEmitHelpers: true async function fn1() { let ar = []; for (let i = 0; i < 1; i++) { await 1; ar.push(() => i); } } async function fn2() { let ar = []; for (let i = 0; i < 1; i++) { await 1; ar.push(() => i); break; } } async function fn3() { let ar = []; for (let i = 0; i < 1; i++) { await 1; ar.push(() => i); continue; } } async function fn4(): Promise<number> { let ar = []; for (let i = 0; i < 1; i++) { await 1; ar.push(() => i); return 1; } }
{ "end_byte": 624, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts" }
TypeScript/tests/cases/compiler/isLiteral1.ts_0_22
var x: number = 02343;
{ "end_byte": 22, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/isLiteral1.ts" }
TypeScript/tests/cases/compiler/inferFromNestedSameShapeTuple.ts_0_810
// @strict: true // @noEmit: true // repro #48524 type Magic<X> = X extends [[infer Y, ...infer _], ...infer __] ? Y : never; type R = Magic<[[number]]> // repro #52722 type Recursive<Id> = { id: Id children: readonly Recursive<Id>[] } declare function getIds<Id>(items: readonly Recursive<Id>[]): Id[]; const items = [{ id: 'a', children: [{ id: 'b', children: [] }] }] as const satisfies readonly Recursive<string>[] const foo = getIds(items) // variant with a fresh argument const foo2 = getIds([{ id: 'a', children: [{ id: 'b', children: [] }] }] as const) // Repro from comment in #49226 type T1<T> = [number, T1<{ x: T }>]; type T2<T> = [42, T2<{ x: T }>]; function qq<U>(x: T1<U>, y: T2<U>) { x = y; y = x; // Error }
{ "end_byte": 810, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/inferFromNestedSameShapeTuple.ts" }
TypeScript/tests/cases/compiler/deeplyNestedMappedTypes.ts_0_4813
// @strict: true // @noEmit: true // Simplified repro from #55535 type Id<T> = { [K in keyof T]: Id<T[K]> }; type Foo1 = Id<{ x: { y: { z: { a: { b: { c: number } } } } } }>; type Foo2 = Id<{ x: { y: { z: { a: { b: { c: string } } } } } }>; declare const foo1: Foo1; const foo2: Foo2 = foo1; // Error expected type Id2<T> = { [K in keyof T]: Id2<Id2<T[K]>> }; type Foo3 = Id2<{ x: { y: { z: { a: { b: { c: number } } } } } }>; type Foo4 = Id2<{ x: { y: { z: { a: { b: { c: string } } } } } }>; declare const foo3: Foo3; const foo4: Foo4 = foo3; // Error expected // Repro from issue linked in #55535 type RequiredDeep<T> = { [K in keyof T]-?: RequiredDeep<T[K]> }; type A = { a?: { b: { c: 1 | { d: 2000 } }}} type B = { a?: { b: { c: { d: { e: { f: { g: 2 }}}}, x: 1000 }}} type C = RequiredDeep<A>; type D = RequiredDeep<B>; type Test1 = [C, D] extends [D, C] ? true : false; // false type Test2 = C extends D ? true : false; // false type Test3 = D extends C ? true : false; // false // Simplified repro from #54246 // Except for the final non-recursive Record<K, V>, object types produced by NestedRecord all have the same symbol // and thus are considered deeply nested after three levels of nesting. Ideally we'd detect that recursion in this // type always terminates, but we're unaware of a general algorithm that accomplishes this. type NestedRecord<K extends string, V> = K extends `${infer K0}.${infer KR}` ? { [P in K0]: NestedRecord<KR, V> } : Record<K, V>; type Bar1 = NestedRecord<"x.y.z.a.b.c", number>; type Bar2 = NestedRecord<"x.y.z.a.b.c", string>; declare const bar1: Bar1; const bar2: Bar2 = bar1; // Error expected // Repro from #56138 export type Input = Static<typeof Input> export const Input = Type.Object({ level1: Type.Object({ level2: Type.Object({ foo: Type.String(), }) }) }) export type Output = Static<typeof Output> export const Output = Type.Object({ level1: Type.Object({ level2: Type.Object({ foo: Type.String(), bar: Type.String(), }) }) }) function problematicFunction1(ors: Input[]): Output[] { return ors; // Error } function problematicFunction2<T extends Output[]>(ors: Input[]): T { return ors; // Error } function problematicFunction3(ors: (typeof Input.static)[]): Output[] { return ors; // Error } export type Evaluate<T> = T extends infer O ? { [K in keyof O]: O[K] } : never export declare const Readonly: unique symbol; export declare const Optional: unique symbol; export declare const Hint: unique symbol; export declare const Kind: unique symbol; export interface TKind { [Kind]: string } export interface TSchema extends TKind { [Readonly]?: string [Optional]?: string [Hint]?: string params: unknown[] static: unknown } export type TReadonlyOptional<T extends TSchema> = TOptional<T> & TReadonly<T> export type TReadonly<T extends TSchema> = T & { [Readonly]: 'Readonly' } export type TOptional<T extends TSchema> = T & { [Optional]: 'Optional' } export interface TString extends TSchema { [Kind]: 'String'; static: string; type: 'string'; } export type ReadonlyOptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? K : never) : never }[keyof T] export type ReadonlyPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? never : K) : never }[keyof T] export type OptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TOptional<TSchema> ? (T[K] extends TReadonly<T[K]> ? never : K) : never }[keyof T] export type RequiredPropertyKeys<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | OptionalPropertyKeys<T>> export type PropertiesReducer<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<( Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys<T>>> & Partial<Pick<R, OptionalPropertyKeys<T>>> & Required<Pick<R, RequiredPropertyKeys<T>>> )> export type PropertiesReduce<T extends TProperties, P extends unknown[]> = PropertiesReducer<T, { [K in keyof T]: Static<T[K], P> }> export type TPropertyKey = string | number export type TProperties = Record<TPropertyKey, TSchema> export interface TObject<T extends TProperties = TProperties> extends TSchema { [Kind]: 'Object' static: PropertiesReduce<T, this['params']> type: 'object' properties: T } export type Static<T extends TSchema, P extends unknown[] = []> = (T & { params: P; })['static'] declare namespace Type { function Object<T extends TProperties>(object: T): TObject<T> function String(): TString }
{ "end_byte": 4813, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/deeplyNestedMappedTypes.ts" }
TypeScript/tests/cases/compiler/nodeResolution5.ts_0_171
// @module: commonjs // @moduleResolution: node // @filename: node_modules/a.d.ts declare module "a" { var x: number; } // @filename: b.ts import y = require("a");
{ "end_byte": 171, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/nodeResolution5.ts" }
TypeScript/tests/cases/compiler/noUnusedLocals_destructuringAssignment.ts_0_249
// @noUnusedLocals: true class C { private x = 0; m(): number { let x: number; ({ x } = this); return x; } private f(): Function { let f: Function; ({ f } = this); return f; } }
{ "end_byte": 249, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noUnusedLocals_destructuringAssignment.ts" }
TypeScript/tests/cases/compiler/moduleSharesNameWithImportDeclarationInsideIt2.ts_3_182
dule Z.M { export function bar() { return ""; } } module A.M { export import M = Z.M; export function bar() { } M.bar(); // Should call Z.M.bar }
{ "end_byte": 182, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleSharesNameWithImportDeclarationInsideIt2.ts" }
TypeScript/tests/cases/compiler/unusedImports16.ts_0_392
//@noUnusedLocals:true //@module: commonjs //@reactNamespace: Element //@jsx: react // @filename: foo.tsx import Element = require("react"); export const FooComponent = <div></div> // @filename: node_modules/@types/react/index.d.ts export = React; export as namespace React; declare namespace React { function createClass<P, S>(spec); } declare global { namespace JSX { } }
{ "end_byte": 392, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedImports16.ts" }
TypeScript/tests/cases/compiler/stringPropCodeGen.ts_0_84
var a = { "foo" : function() { }, "bar" : 5 }; a.foo(); a.bar.toString();
{ "end_byte": 84, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/stringPropCodeGen.ts" }
TypeScript/tests/cases/compiler/recursiveGenericUnionType1.ts_0_433
declare module Test1 { export type Container<T> = T | { [i: string]: Container<T>; }; export type IStringContainer = Container<string>; } declare module Test2 { export type Container<T> = T | { [i: string]: Container<T>; }; export type IStringContainer = Container<string>; } var x: Test1.Container<number>; var s1: Test1.IStringContainer; var s2: Test2.IStringContainer; s1 = s2; s2 = s1;
{ "end_byte": 433, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveGenericUnionType1.ts" }
TypeScript/tests/cases/compiler/missingFunctionImplementation.ts_1_1264
export class C1 { m(): void; } // merged with a namespace export class C2 { m(): void; } export namespace C2 { } // merged with a namespace, multiple overloads class C3 { m(a, b); m(a); } namespace C3 { } // static methods, multiple overloads class C4 { static m(a): void; } // static methods, multiple overloads class C5 { static m(a): void; static m(): void; } // merged with namespace, static methods class C6 { static m(): void; } namespace C6 { } // merged with namespace, static methods, multiple overloads class C7 { static m(a): void; static m(): void; } namespace C7 { } // merged with namespace, static methods, duplicate declarations class C8 { static m(a): void; static m(a, b): void; } namespace C8 { export function m(a?, b?): void { } } // merged with namespace, static methods, duplicate declarations class C9 { static m(a): void { } } namespace C9 { export function m(a): void; } // merged namespaces namespace N10 { export function m(a): void; } namespace N10 { export function m(a): void { } } // merged namespaces, duplicate defintions namespace N12 { export function m(a): void; export function m(): void; export function m(a?): void { } } namespace N12 { export function m(a): void { } }
{ "end_byte": 1264, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/missingFunctionImplementation.ts" }
TypeScript/tests/cases/compiler/checkJsFiles3.ts_0_92
// @allowJs: true // @noEmit: true // @fileName: a.js // @ts-check var x = "string"; x = 0;
{ "end_byte": 92, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/checkJsFiles3.ts" }
TypeScript/tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExport.ts_0_150
//@module: amd // @declaration: true export module a { export interface I { } } export module c { import b = a.I; export var x: b; }
{ "end_byte": 150, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExport.ts" }
TypeScript/tests/cases/compiler/commentsAtEndOfFile1.ts_0_52
// @allowUnusedLabels: true Input: ; //Testing two
{ "end_byte": 52, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/commentsAtEndOfFile1.ts" }
TypeScript/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts_0_647
// @lib: es5 // @sourcemap: true declare var console: { log(msg: any): void; } type Robot = [number, string, string]; var robotA: Robot = [1, "mower", "mowing"]; function foo1([, nameA]: Robot) { console.log(nameA); } function foo2([numberB]: Robot) { console.log(numberB); } function foo3([numberA2, nameA2, skillA2]: Robot) { console.log(nameA2); } function foo4([numberA3, ...robotAInfo]: Robot) { console.log(robotAInfo); } foo1(robotA); foo1([2, "trimmer", "trimming"]); foo2(robotA); foo2([2, "trimmer", "trimming"]); foo3(robotA); foo3([2, "trimmer", "trimming"]); foo4(robotA); foo4([2, "trimmer", "trimming"]);
{ "end_byte": 647, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts" }
TypeScript/tests/cases/compiler/vueLikeDataAndPropsInference.ts_0_913
interface Instance { _instanceBrand: never } type DataDef<Data, Props> = (this: Readonly<Props> & Instance) => Data type PropsDefinition<T> = { [K in keyof T]: T[K] } interface Options< Data = ((this: Instance) => object), PropsDef = {} > { data?: Data props?: PropsDef watch?: Record<string, WatchHandler<any>> } type WatchHandler<T> = (val: T, oldVal: T) => void; type ThisTypedOptions<Data, Props> = Options<DataDef<Data, Props>, PropsDefinition<Props>> & ThisType<Data & Readonly<Props> & Instance> declare function test<Data, Props>(fn: ThisTypedOptions<Data, Props>): void; declare function test(fn: Options): void; test({ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } } })
{ "end_byte": 913, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/vueLikeDataAndPropsInference.ts" }
TypeScript/tests/cases/compiler/importUsedInGenericImportResolves.ts_0_235
// @filename: test1.d.ts export interface T<P> { a: P; } // @filename: test2.d.ts export declare const theme: { a: string } // @filename: test3.ts export const a: import("./test1").T<typeof import("./test2").theme> = null as any;
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importUsedInGenericImportResolves.ts" }
TypeScript/tests/cases/compiler/externModuleClobber.ts_0_181
declare module EM { export class Position { } export class EC { public getPosition() : EM.Position; } } var x:EM.Position; var ec:EM.EC = new EM.EC(); x = ec.getPosition();
{ "end_byte": 181, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/externModuleClobber.ts" }
TypeScript/tests/cases/compiler/declarationEmitPartialNodeReuseTypeReferences.ts_0_528
// @strict: true // @declaration: true // @target: es2020 // @filename: a.ts export type SpecialString = string; type PrivateSpecialString = string; export namespace N { export type SpecialString = string; } export const o = (p1: SpecialString, p2: PrivateSpecialString, p3: N.SpecialString) => null! as { foo: SpecialString, bar: PrivateSpecialString, baz: N.SpecialString }; // @filename: b.ts import * as a from "./a"; export const g = a.o // @filename: c.ts import { o, SpecialString } from "./a"; export const g = o
{ "end_byte": 528, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitPartialNodeReuseTypeReferences.ts" }
TypeScript/tests/cases/compiler/genericArrayWithoutTypeAnnotation.ts_0_74
interface IFoo<T>{ } class Bar { public getBar(foo: IFoo[]) { } }
{ "end_byte": 74, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/genericArrayWithoutTypeAnnotation.ts" }
TypeScript/tests/cases/compiler/declInput3.ts_0_196
// @declaration: true interface bar2 { } class bar { public f() { return ''; } public g() { return {a: <bar>null, b: undefined, c: void 4 }; } public h(x = 4, y = null, z = '') { x++; } }
{ "end_byte": 196, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declInput3.ts" }
TypeScript/tests/cases/compiler/noSubtypeReduction.ts_0_367
// @strict: true // @noEmit: true // Repro from #53425 export interface IA { arr: { A: number; }[]; } export interface IAB { arr: { A: number; B: number; }[]; } export function F(x: IA | IAB) { const useB = (t: number) => { }; for (const el of x.arr) { if ('A' in el) { } if ('B' in el) { useB(el.B); } } }
{ "end_byte": 367, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/noSubtypeReduction.ts" }
TypeScript/tests/cases/compiler/superCallArgsMustMatch.ts_0_331
class T5<T>{ public foo: T; constructor(public bar: T) { } } class T6 extends T5<number>{ constructor() { // Should error; base constructor has type T for first arg, // which is instantiated with 'number' in the extends clause super("hi"); var x: number = this.foo; } }
{ "end_byte": 331, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superCallArgsMustMatch.ts" }
TypeScript/tests/cases/compiler/declarationEmitMappedPrivateTypeTypeParameter.ts_0_222
// @declaration: true // @filename: /Helpers.ts export type StringKeyOf<TObj> = Extract<string, keyof TObj>; // @filename: /FromFactor.ts export type RowToColumns<TColumns> = { [TName in StringKeyOf<TColumns>]: any; }
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/declarationEmitMappedPrivateTypeTypeParameter.ts" }
TypeScript/tests/cases/compiler/moduleResolutionWithSuffixes_one.ts_0_359
// moduleSuffixes has one entry and there's a matching file. // @filename: /tsconfig.json { "compilerOptions": { "moduleResolution": "node", "traceResolution": true, "moduleSuffixes": [".ios"] } } // @filename: /index.ts import { ios } from "./foo"; // @filename: /foo.ios.ts export function ios() {} // @filename: /foo.ts export function base() {}
{ "end_byte": 359, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/moduleResolutionWithSuffixes_one.ts" }
TypeScript/tests/cases/compiler/differentTypesWithSameName.ts_0_198
module m { export class variable{ s: string; } export function doSomething(v: m.variable) { } } class variable { t: number; } var v: variable = new variable(); m.doSomething(v);
{ "end_byte": 198, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/differentTypesWithSameName.ts" }
TypeScript/tests/cases/compiler/conditionalExpressionNewLine3.ts_0_20
var v = a ? b : c;
{ "end_byte": 20, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/conditionalExpressionNewLine3.ts" }
TypeScript/tests/cases/compiler/bigintIndex.ts_0_644
// @target: es2020 // @filename: a.ts interface BigIntIndex<E> { [index: bigint]: E; // should error } const arr: number[] = [1, 2, 3]; let num: number = arr[1]; num = arr["1"]; num = arr[1n]; // should error num = [1, 2, 3][1n]; // should error let key: keyof any; // should be type "string | number | symbol" key = 123; key = "abc"; key = Symbol(); key = 123n; // should error // Show correct usage of bigint index: explicitly convert to string const bigNum: bigint = 0n; const typedArray = new Uint8Array(3); typedArray[bigNum] = 0xAA; // should error typedArray[String(bigNum)] = 0xAA; typedArray["1"] = 0xBB; typedArray[2] = 0xCC;
{ "end_byte": 644, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/bigintIndex.ts" }
TypeScript/tests/cases/compiler/overloadsWithComputedNames.ts_0_1075
// https://github.com/microsoft/TypeScript/issues/52329 class Person { ["B"](a: number): string; ["A"](a: string|number): number | string { return 0; } } let p = new Person(); p.A(0) p.B(0) // https://github.com/microsoft/TypeScript/issues/17345 class C { ["foo"](): void ["bar"](): void; ["foo"]() { return 0; } } declare const uniqueSym: unique symbol; declare const uniqueSym2: unique symbol; declare const sym: symbol; declare const strUnion: 'foo' | 'bar'; class C1 { [sym](): void; // should error [uniqueSym2](): void; // should error [uniqueSym](): void; [uniqueSym]() { } } interface I1 { [sym](): void; // should error [uniqueSym2](): void; [uniqueSym](): void; [uniqueSym](): void; } class C2 { [strUnion](): void; // should error [strUnion]() { } } class I2 { [strUnion](): void; // should error [strUnion]() { } } class C3 { [1](): void; // should error [2](): void; [2]() { } } interface I3 { [1](): void; [2](): void; [2](): void; }
{ "end_byte": 1075, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/overloadsWithComputedNames.ts" }
TypeScript/tests/cases/compiler/recursiveClassReferenceTest.ts_0_1912
// @lib: es5 // @sourcemap: true // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter declare module Sample.Thing { export interface IWidget { getDomNode(): any; destroy(); gar(runner:(widget:Sample.Thing.IWidget)=>any):any; } export interface ICodeThing { getDomNode(): Element; addWidget(widgetId:string, widget:IWidget); focus(); //addWidget(widget: Sample.Thing.Widgets.IWidget); } export interface IAction { run(Thing:ICodeThing):boolean; getId():string; } } module Sample.Actions.Thing.Find { export class StartFindAction implements Sample.Thing.IAction { public getId() { return "yo"; } public run(Thing:Sample.Thing.ICodeThing):boolean { return true; } } } module Sample.Thing.Widgets { export class FindWidget implements Sample.Thing.IWidget { public gar(runner:(widget:Sample.Thing.IWidget)=>any) { if (true) {return runner(this);}} private domNode:any = null; constructor(private codeThing: Sample.Thing.ICodeThing) { // scenario 1 codeThing.addWidget("addWidget", this); } public getDomNode() { return domNode; } public destroy() { } } } interface IMode { getInitialState(): IState;} class AbstractMode implements IMode { public getInitialState(): IState { return null;} } interface IState {} interface Window { opener: Window; } declare var self: Window; module Sample.Thing.Languages.PlainText { export class State implements IState { constructor(private mode: IMode) { } public clone():IState { return this; } public equals(other:IState):boolean { return this === other; } public getMode(): IMode { return mode; } } export class Mode extends AbstractMode { // scenario 2 public getInitialState(): IState { return new State(self); } } }
{ "end_byte": 1912, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/recursiveClassReferenceTest.ts" }
TypeScript/tests/cases/compiler/requireOfJsonFileWithModuleNodeResolutionEmitAmdOutFile.ts_0_234
// @module: amd // @moduleResolution: node // @outFile: out/output.js // @fullEmitPaths: true // @resolveJsonModule: true // @Filename: file1.ts import * as b from './b.json'; // @Filename: b.json { "a": true, "b": "hello" }
{ "end_byte": 234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/requireOfJsonFileWithModuleNodeResolutionEmitAmdOutFile.ts" }
TypeScript/tests/cases/compiler/es6ImportNamedImport.ts_0_1168
// @target: es6 // @module: commonjs // @declaration: true // @filename: es6ImportNamedImport_0.ts export var a = 10; export var x = a; export var m = a; export var a1 = 10; export var x1 = 10; export var z1 = 10; export var z2 = 10; export var aaaa = 10; // @filename: es6ImportNamedImport_1.ts import { } from "./es6ImportNamedImport_0"; import { a } from "./es6ImportNamedImport_0"; var xxxx = a; import { a as b } from "./es6ImportNamedImport_0"; var xxxx = b; import { x, a as y } from "./es6ImportNamedImport_0"; var xxxx = x; var xxxx = y; import { x as z, } from "./es6ImportNamedImport_0"; var xxxx = z; import { m, } from "./es6ImportNamedImport_0"; var xxxx = m; import { a1, x1 } from "./es6ImportNamedImport_0"; var xxxx = a1; var xxxx = x1; import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; var xxxx = a11; var xxxx = x11; import { z1 } from "./es6ImportNamedImport_0"; var z111 = z1; import { z2 as z3 } from "./es6ImportNamedImport_0"; var z2 = z3; // z2 shouldn't give redeclare error // These are elided import { aaaa } from "./es6ImportNamedImport_0"; // These are elided import { aaaa as bbbb } from "./es6ImportNamedImport_0";
{ "end_byte": 1168, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/es6ImportNamedImport.ts" }
TypeScript/tests/cases/compiler/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.ts_0_109
interface I<T> { new <U extends T>(u: U): U; } var i: I<string>; var y = new i(""); // y should be string
{ "end_byte": 109, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.ts" }
TypeScript/tests/cases/compiler/enumWithComputedMember.ts_0_49
enum A { X = "".length, Y = X, Z }
{ "end_byte": 49, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/enumWithComputedMember.ts" }
TypeScript/tests/cases/compiler/typeParameterConstraintInstantiation.ts_0_221
// Check that type parameter constraints are properly instantiated interface Mapper<T> { map<U extends T, V extends U[]>(f: (item: T) => U): V; } var m: Mapper<string>; var a = m.map((x: string) => x); // string[]
{ "end_byte": 221, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/typeParameterConstraintInstantiation.ts" }
TypeScript/tests/cases/compiler/augmentedTypesEnum.ts_0_708
// enum then var enum e1111 { One } // error var e1111 = 1; // error // enum then function enum e2 { One } // error function e2() { } // error enum e3 { One } // error var e3 = () => { } // error // enum then class enum e4 { One } // error class e4 { public foo() { } } // error // enum then enum enum e5 { One } enum e5 { Two } // error enum e5a { One } // error enum e5a { One } // error // enum then internal module enum e6 { One } module e6 { } // ok enum e6a { One } module e6a { var y = 2; } // should be error enum e6b { One } module e6b { export var y = 2; } // should be error // enum then import, messes with error reporting //enum e7 { One } //import e7 = require(''); // should be error
{ "end_byte": 708, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/augmentedTypesEnum.ts" }
TypeScript/tests/cases/compiler/mappedArrayTupleIntersections.ts_0_532
// @strict: true // @noEmit: true type Box<T> = { value: T }; type Boxify<T> = { [K in keyof T]: Box<T[K]> }; type T1 = Boxify<string[]>; type T2 = Boxify<[string, string]>; type T3 = Boxify<string[] & unknown[]>; type T4 = Boxify<string[] & [string, string]>; type T5 = Boxify<string[] & { x: string }>; // https://github.com/microsoft/TypeScript/issues/57744 type MustBeArray<T extends any[]> = T; type Hmm<T extends any[]> = T extends number[] ? MustBeArray<{ [I in keyof T]: 1 }> : never; type X = Hmm<[3, 4, 5]>;
{ "end_byte": 532, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/mappedArrayTupleIntersections.ts" }
TypeScript/tests/cases/compiler/objectLiteralDeclarationGeneration1.ts_0_46
// @declaration: true class y<T extends {}>{ }
{ "end_byte": 46, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/objectLiteralDeclarationGeneration1.ts" }
TypeScript/tests/cases/compiler/functionWithDefaultParameterWithNoStatements2.ts_0_23
function foo(x = 0) { }
{ "end_byte": 23, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/functionWithDefaultParameterWithNoStatements2.ts" }
TypeScript/tests/cases/compiler/getterThatThrowsShouldNotNeedReturn.ts_0_165
class Greeter { public get greet(): string { throw ''; // should not raise an error } public greeting(): string { throw ''; // should not raise an error } }
{ "end_byte": 165, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/getterThatThrowsShouldNotNeedReturn.ts" }
TypeScript/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts_3_230
@removeComments: true class C { /*! remove pinned comment anywhere else */ public foo(x: string, y: any) public foo(x: string, y: number) { } } /*! remove pinned comment anywhere else */ declare var OData: any;
{ "end_byte": 230, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts" }
TypeScript/tests/cases/compiler/capturedLetConstInLoop11.ts_0_168
for (;;) { let x = 1; () => x; } function foo() { for (;;) { const a = 0; switch(a) { case 0: return () => a; } } }
{ "end_byte": 168, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop11.ts" }
TypeScript/tests/cases/compiler/spellingSuggestionGlobal1.ts_0_93
export {} declare global { const x: any } global.x // should not suggest `global` (GH#42209)
{ "end_byte": 93, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/spellingSuggestionGlobal1.ts" }
TypeScript/tests/cases/compiler/importHelpersSystem.ts_0_737
// @importHelpers: true // @target: es5 // @module: system // @filename: a.ts export class A { } // @filename: b.ts import { A } from "./a"; export * from "./a"; export class B extends A { } // @filename: tslib.d.ts export declare function __extends(d: Function, b: Function): void; export declare function __assign(t: any, ...sources: any[]): any; export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; export declare function __param(paramIndex: number, decorator: Function): Function; export declare function __metadata(metadataKey: any, metadataValue: any): Function; export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
{ "end_byte": 737, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/importHelpersSystem.ts" }
TypeScript/tests/cases/compiler/capturedLetConstInLoop4.ts_0_2441
// @module: system //======let export function exportedFoo() { return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8; } for (let x of []) { var v0 = x; (function() { return x + v0}); (() => x); } for (let x in []) { var v00 = x; (function() { return x + v00}); (() => x); } for (let x = 0; x < 1; ++x) { var v1 = x; (function() { return x + v1}); (() => x); } while (1 === 1) { let x; var v2 = x; (function() { return x + v2}); (() => x); } do { let x; var v3 = x; (function() { return x + v3}); (() => x); } while (1 === 1) for (let y = 0; y < 1; ++y) { let x = 1; var v4 = x; (function() { return x + v4}); (() => x); } for (let x = 0, y = 1; x < 1; ++x) { var v5 = x; (function() { return x + y + v5}); (() => x + y); } while (1 === 1) { let x, y; var v6 = x; (function() { return x + y + v6}); (() => x + y); } do { let x, y; var v7 = x; (function() { return x + y + v7}); (() => x + y); } while (1 === 1) for (let y = 0; y < 1; ++y) { let x = 1; var v8 = x; (function() { return x + y + v8}); (() => x + y); } //======const export function exportedFoo2() { return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; } for (const x of []) { var v0_c = x; (function() { return x + v0_c}); (() => x); } for (const x in []) { var v00_c = x; (function() { return x + v00}); (() => x); } for (const x = 0; x < 1;) { var v1_c = x; (function() { return x + v1_c}); (() => x); } while (1 === 1) { const x =1; var v2_c = x; (function() { return x + v2_c}); (() => x); } do { const x = 1; var v3_c = x; (function() { return x + v3_c}); (() => x); } while (1 === 1) for (const y = 0; y < 1;) { const x = 1; var v4_c = x; (function() { return x + v4_c}); (() => x); } for (const x = 0, y = 1; x < 1;) { var v5_c = x; (function() { return x + y + v5_c}); (() => x + y); } while (1 === 1) { const x = 1, y = 1; var v6_c = x; (function() { return x + y + v6_c}); (() => x + y); } do { const x = 1, y = 1; var v7_c = x; (function() { return x + y + v7_c}); (() => x + y); } while (1 === 1) for (const y = 0; y < 1;) { const x = 1; var v8_c = x; (function() { return x + y + v8_c}); (() => x + y); }
{ "end_byte": 2441, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/capturedLetConstInLoop4.ts" }
TypeScript/tests/cases/compiler/castParentheses.ts_3_188
ass a { static b: any; } var b = (<any>a); var b = (<any>a).b; var b = (<any>a.b).c; var b = (<any>a.b()).c; var b = (<any>new a); var b = (<any>new a.b); var b = (<any>new a).b
{ "end_byte": 188, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/castParentheses.ts" }
TypeScript/tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts_0_135
interface A<T extends A<T, S>, S extends A<T, S>> { } interface B<T extends B<T, S>, S extends B<T, S>> extends A<B<T, S>, B<T, S>> { }
{ "end_byte": 135, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts" }
TypeScript/tests/cases/compiler/privacyGloFunc.ts_0_7314
//@module: amd export module m1 { export class C1_public { private f1() { } } class C2_private { } export class C3_public { constructor (m1_c3_c1: C1_public); constructor (m1_c3_c2: C2_private); //error constructor (m1_c3_c1_2: any) { } private f1_private(m1_c3_f1_arg: C1_public) { } public f2_public(m1_c3_f2_arg: C1_public) { } private f3_private(m1_c3_f3_arg: C2_private) { } public f4_public(m1_c3_f4_arg: C2_private) { // error } private f5_private() { return new C1_public(); } public f6_public() { return new C1_public(); } private f7_private() { return new C2_private(); } public f8_public() { return new C2_private(); // error } private f9_private(): C1_public { return new C1_public(); } public f10_public(): C1_public { return new C1_public(); } private f11_private(): C2_private { return new C2_private(); } public f12_public(): C2_private { // error return new C2_private(); //error } } class C4_private { constructor (m1_c4_c1: C1_public); constructor (m1_c4_c2: C2_private); constructor (m1_c4_c1_2: any) { } private f1_private(m1_c4_f1_arg: C1_public) { } public f2_public(m1_c4_f2_arg: C1_public) { } private f3_private(m1_c4_f3_arg: C2_private) { } public f4_public(m1_c4_f4_arg: C2_private) { } private f5_private() { return new C1_public(); } public f6_public() { return new C1_public(); } private f7_private() { return new C2_private(); } public f8_public() { return new C2_private(); } private f9_private(): C1_public { return new C1_public(); } public f10_public(): C1_public { return new C1_public(); } private f11_private(): C2_private { return new C2_private(); } public f12_public(): C2_private { return new C2_private(); } } export class C5_public { constructor (m1_c5_c: C1_public) { } } class C6_private { constructor (m1_c6_c: C1_public) { } } export class C7_public { constructor (m1_c7_c: C2_private) { // error } } class C8_private { constructor (m1_c8_c: C2_private) { } } function f1_public(m1_f1_arg: C1_public) { } export function f2_public(m1_f2_arg: C1_public) { } function f3_public(m1_f3_arg: C2_private) { } export function f4_public(m1_f4_arg: C2_private) { // error } function f5_public() { return new C1_public(); } export function f6_public() { return new C1_public(); } function f7_public() { return new C2_private(); } export function f8_public() { return new C2_private(); // error } function f9_private(): C1_public { return new C1_public(); } export function f10_public(): C1_public { return new C1_public(); } function f11_private(): C2_private { return new C2_private(); } export function f12_public(): C2_private { // error return new C2_private(); //error } } module m2 { export class m2_C1_public { private f() { } } class m2_C2_private { } export class m2_C3_public { constructor (m2_c3_c1: m2_C1_public); constructor (m2_c3_c2: m2_C2_private); constructor (m2_c3_c1_2: any) { } private f1_private(m2_c3_f1_arg: m2_C1_public) { } public f2_public(m2_c3_f2_arg: m2_C1_public) { } private f3_private(m2_c3_f3_arg: m2_C2_private) { } public f4_public(m2_c3_f4_arg: m2_C2_private) { } private f5_private() { return new m2_C1_public(); } public f6_public() { return new m2_C1_public(); } private f7_private() { return new m2_C2_private(); } public f8_public() { return new m2_C2_private(); } private f9_private(): m2_C1_public { return new m2_C1_public(); } public f10_public(): m2_C1_public { return new m2_C1_public(); } private f11_private(): m2_C2_private { return new m2_C2_private(); } public f12_public(): m2_C2_private { return new m2_C2_private(); } } class m2_C4_private { constructor (m2_c4_c1: m2_C1_public); constructor (m2_c4_c2: m2_C2_private); constructor (m2_c4_c1_2: any) { } private f1_private(m2_c4_f1_arg: m2_C1_public) { } public f2_public(m2_c4_f2_arg: m2_C1_public) { } private f3_private(m2_c4_f3_arg: m2_C2_private) { } public f4_public(m2_c4_f4_arg: m2_C2_private) { } private f5_private() { return new m2_C1_public(); } public f6_public() { return new m2_C1_public(); } private f7_private() { return new m2_C2_private(); } public f8_public() { return new m2_C2_private(); } private f9_private(): m2_C1_public { return new m2_C1_public(); } public f10_public(): m2_C1_public { return new m2_C1_public(); } private f11_private(): m2_C2_private { return new m2_C2_private(); } public f12_public(): m2_C2_private { return new m2_C2_private(); } } export class m2_C5_public { constructor (m2_c5_c: m2_C1_public) { } } class m2_C6_private { constructor (m2_c6_c: m2_C1_public) { } } export class m2_C7_public { constructor (m2_c7_c: m2_C2_private) { } } class m2_C8_private { constructor (m2_c8_c: m2_C2_private) { } } function f1_public(m2_f1_arg: m2_C1_public) { } export function f2_public(m2_f2_arg: m2_C1_public) { } function f3_public(m2_f3_arg: m2_C2_private) { } export function f4_public(m2_f4_arg: m2_C2_private) { } function f5_public() { return new m2_C1_public(); } export function f6_public() { return new m2_C1_public(); } function f7_public() { return new m2_C2_private(); } export function f8_public() { return new m2_C2_private(); } function f9_private(): m2_C1_public { return new m2_C1_public(); } export function f10_public(): m2_C1_public { return new m2_C1_public(); } function f11_private(): m2_C2_private { return new m2_C2_private(); } export function f12_public(): m2_C2_private { return new m2_C2_private(); } }
{ "end_byte": 7314, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyGloFunc.ts" }
TypeScript/tests/cases/compiler/privacyGloFunc.ts_7316_10318
class C5_private { private f() { } } export class C6_public { } export class C7_public { constructor (c7_c1: C5_private); // error constructor (c7_c2: C6_public); constructor (c7_c1_2: any) { } private f1_private(c7_f1_arg: C6_public) { } public f2_public(c7_f2_arg: C6_public) { } private f3_private(c7_f3_arg: C5_private) { } public f4_public(c7_f4_arg: C5_private) { //error } private f5_private() { return new C6_public(); } public f6_public() { return new C6_public(); } private f7_private() { return new C5_private(); } public f8_public() { return new C5_private(); //error } private f9_private(): C6_public { return new C6_public(); } public f10_public(): C6_public { return new C6_public(); } private f11_private(): C5_private { return new C5_private(); } public f12_public(): C5_private { //error return new C5_private(); //error } } class C8_private { constructor (c8_c1: C5_private); constructor (c8_c2: C6_public); constructor (c8_c1_2: any) { } private f1_private(c8_f1_arg: C6_public) { } public f2_public(c8_f2_arg: C6_public) { } private f3_private(c8_f3_arg: C5_private) { } public f4_public(c8_f4_arg: C5_private) { } private f5_private() { return new C6_public(); } public f6_public() { return new C6_public(); } private f7_private() { return new C5_private(); } public f8_public() { return new C5_private(); } private f9_private(): C6_public { return new C6_public(); } public f10_public(): C6_public { return new C6_public(); } private f11_private(): C5_private { return new C5_private(); } public f12_public(): C5_private { return new C5_private(); } } export class C9_public { constructor (c9_c: C6_public) { } } class C10_private { constructor (c10_c: C6_public) { } } export class C11_public { constructor (c11_c: C5_private) { // error } } class C12_private { constructor (c12_c: C5_private) { } } function f1_private(f1_arg: C5_private) { } export function f2_public(f2_arg: C5_private) { // error } function f3_private(f3_arg: C6_public) { } export function f4_public(f4_arg: C6_public) { } function f5_private() { return new C6_public(); } export function f6_public() { return new C6_public(); } function f7_private() { return new C5_private(); } export function f8_public() { return new C5_private(); //error } function f9_private(): C6_public { return new C6_public(); } export function f10_public(): C6_public { return new C6_public(); } function f11_private(): C5_private { return new C5_private(); } export function f12_public(): C5_private { //error return new C5_private(); //error }
{ "end_byte": 10318, "start_byte": 7316, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/privacyGloFunc.ts" }
TypeScript/tests/cases/compiler/unusedInterfaceinNamespace4.ts_0_217
//@noUnusedLocals:true //@noUnusedParameters:true namespace Validation { interface i1 { } export interface i2 { } interface i3 extends i1 { } export class c1 implements i3 { } }
{ "end_byte": 217, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/unusedInterfaceinNamespace4.ts" }
TypeScript/tests/cases/compiler/missingPropertiesOfClassExpression.ts_0_105
class George extends class { reset() { return this.y; } } { constructor() { super(); } }
{ "end_byte": 105, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/missingPropertiesOfClassExpression.ts" }
TypeScript/tests/cases/compiler/arrayFlatNoCrashInference.ts_0_105
// @strict: true // @lib: es2020 function foo<T>(arr: T[], depth: number) { return arr.flat(depth); }
{ "end_byte": 105, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/arrayFlatNoCrashInference.ts" }