_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/conformance/moduleResolution/node10IsNode_node10.ts_0_543
// @moduleResolution: node10 // @module: commonjs // @noEmit: true // @traceResolution: true // @Filename: /node_modules/fancy-lib/package.json { "name": "fancy-lib", "version": "1.0.0", "main": "index.js", "exports": { ".": "./definitely-not-index.js" } } // @Filename: /node_modules/fancy...
{ "end_byte": 543, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/node10IsNode_node10.ts" }
TypeScript/tests/cases/conformance/moduleResolution/node10IsNode_node.ts_0_541
// @moduleResolution: node // @module: commonjs // @noEmit: true // @traceResolution: true // @Filename: /node_modules/fancy-lib/package.json { "name": "fancy-lib", "version": "1.0.0", "main": "index.js", "exports": { ".": "./definitely-not-index.js" } } // @Filename: /node_modules/fancy-l...
{ "end_byte": 541, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/node10IsNode_node.ts" }
TypeScript/tests/cases/conformance/moduleResolution/typesVersions.multiFile.ts_0_712
// @traceResolution: true // @target: esnext // @module: commonjs // @filename: node_modules/ext/package.json { "name": "ext", "version": "1.0.0", "types": "index", "typesVersions": { ">=3.1.0-0": { "*" : ["ts3.1/*"] } } } // @filename: node_modules/ext/index.d.ts export const a = "default ...
{ "end_byte": 712, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/typesVersions.multiFile.ts" }
TypeScript/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts_0_855
// @module: esnext // @moduleResolution: node16,nodenext,bundler // @traceResolution: true // @allowJs: true // @noTypesAndSymbols: true // @noEmit: true // This documents bug https://github.com/microsoft/TypeScript/issues/50762. // @Filename: /node_modules/dep/package.json { "name": "dep", "version": "1.0.0", ...
{ "end_byte": 855, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash1.ts_0_678
// @noTypesAndSymbols: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } } } // @Filename: /node_modules/@types/foo/index.d.mts export {}; declare global { const...
{ "end_byte": 678, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash1.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_withAugmentation.ts_0_289
// @noImplicitReferences: true // @currentDirectory: / // This tests that augmenting an untyped module is forbidden. // @filename: /node_modules/foo/index.js This file is not processed. // @filename: /a.ts declare module "foo" { export const x: number; } import { x } from "foo"; x;
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_withAugmentation.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport.ts_0_475
// @noImplicitReferences: true // @currentDirectory: / // This tests that importing from a JS file globally works in an untyped way. // (Assuming we don't have `--noImplicitAny` or `--allowJs`.) // @filename: /node_modules/foo/index.js This file is not processed. // @filename: /a.ts import * as foo from "foo"; foo.ba...
{ "end_byte": 475, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport.ts" }
TypeScript/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts_0_444
// @allowImportingTsExtensions: true,false // @noEmit: true // @moduleResolution: classic,node10,node16,nodenext // @noTypesAndSymbols: true // @Filename: /types.d.ts export declare type User = { name: string; } // @Filename: /a.ts import type { User } from "./types.d.ts"; export type { User } from "./types.d.ts"...
{ "end_byte": 444, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts" }
TypeScript/tests/cases/conformance/moduleResolution/customConditions.ts_0_725
// @module: preserve // @moduleResolution: bundler // @customConditions: webpack, browser // @resolvePackageJsonExports: true, false // @traceResolution: true // @Filename: /node_modules/lodash/package.json { "name": "lodash", "version": "1.0.0", "main": "index.js", "exports": { "browser": "./b...
{ "end_byte": 725, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/customConditions.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs.ts_0_333
// @noImplicitReferences: true // @currentDirectory: / // @allowJs: true // @maxNodeModuleJsDepth: 1 // Same as untypedModuleImport.ts but with --allowJs, so the package will actually be typed. // @filename: /node_modules/foo/index.js exports.default = { bar() { return 0; } } // @filename: /a.ts import foo from "foo"...
{ "end_byte": 333, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny.ts_0_321
// @noImplicitReferences: true // @noImplicitAny: true // This tests that `--noImplicitAny` disables untyped modules. // @filename: /node_modules/foo/package.json { "name": "foo", "version": "1.2.3" } // @filename: /node_modules/foo/index.js This file is not processed. // @filename: /a.ts import * as foo from "foo";...
{ "end_byte": 321, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash5.ts_0_702
// @noTypesAndSymbols: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } } } // @Filename: /node_modules/@types/foo/index.d.mts export {}; declare global { const...
{ "end_byte": 702, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash5.ts" }
TypeScript/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts_0_424
// @moduleResolution: classic,node,node16,nodenext,bundler // @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /project/a.js export default "a.js"; // @Filename: /project/a.js.js export default "a.js.js"; // @Filename: /project/dir/index.ts export default "dir/index.ts"; // @Filename: /project/dir.js...
{ "end_byte": 424, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts" }
TypeScript/tests/cases/conformance/moduleResolution/scopedPackages.ts_0_420
// @noImplicitReferences: true // @traceResolution: true // @typeRoots: types // @filename: /node_modules/@cow/boy/index.d.ts export const x: number; // @filename: /node_modules/@types/be__bop/index.d.ts export const y: number; // @filename: /node_modules/@types/be__bop/e/z.d.ts export const z: number; // @filename...
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/scopedPackages.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash4.ts_0_680
// @noTypesAndSymbols: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } } } // @Filename: /node_modules/@types/foo/index.d.mts export {}; declare global { const...
{ "end_byte": 680, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash4.ts" }
TypeScript/tests/cases/conformance/moduleResolution/scopedPackagesClassic.ts_0_235
// @noImplicitReferences: true // @traceResolution: true // @typeRoots: types // @moduleResolution: classic // @filename: /node_modules/@types/see__saw/index.d.ts export const x = 0; // @filename: /a.ts import { x } from "@see/saw";
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/scopedPackagesClassic.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeImportType1.ts_0_1019
// @module: esnext // @moduleResolution: bundler, node10, classic // @noEmit: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } } } // @Filename: /node_modules/@ty...
{ "end_byte": 1019, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeImportType1.ts" }
TypeScript/tests/cases/conformance/moduleResolution/packageJsonExportsOptionsCompat.ts_0_293
// @noTypesAndSymbols: true // @Filename: /tsconfig.json { "compilerOptions": { "moduleResolution": "classic", "customConditions": ["webpack", "browser"], "resolvePackageJsonExports": true, "resolvePackageJsonImports": true, "noEmit": true } } // @Filename: /index.ts
{ "end_byte": 293, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/packageJsonExportsOptionsCompat.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny_scoped.ts_0_278
// @noImplicitReferences: true // @noImplicitAny: true // @filename: /node_modules/@foo/bar/package.json { "name": "@foo/bar", "version": "1.2.3" } // @filename: /node_modules/@foo/bar/index.js This file is not processed. // @filename: /a.ts import * as foo from "@foo/bar";
{ "end_byte": 278, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny_scoped.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny_typesForPackageExist.ts_0_1262
// @noImplicitReferences: true // @strict: true // @Filename: /node_modules/@types/foo/index.d.ts export const foo: number; // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.2.3" } // @Filename: /node_modules/foo/sub.js const x = 0; // @Filename: /node_modules/foo/package.jso...
{ "end_byte": 1262, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny_typesForPackageExist.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny_relativePath.ts_0_273
// @noImplicitReferences: true // @noImplicitAny: true // @filename: /node_modules/foo/package.json { "name": "foo", "version": "1.2.3" } // @filename: /node_modules/foo/index.js This file is not processed. // @filename: /a.ts import * as foo from "./node_modules/foo";
{ "end_byte": 273, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_noImplicitAny_relativePath.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash3.ts_0_703
// @noTypesAndSymbols: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } } } // @Filename: /node_modules/@types/foo/index.d.mts export {}; declare global { const...
{ "end_byte": 703, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash3.ts" }
TypeScript/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts_0_309
// @baseUrl: / // @traceResolution: true // @target: esnext // @module: commonjs // @filename: /a/package.json { "types": "", "typesVersions": { ">=3.1.0-0": { "*" : ["ts3.1/*"] } } } // @filename: /a/ts3.1/index.d.ts export const a = 0; // @filename: /b/user.ts import { a } from "a";
{ "end_byte": 309, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolvesWithoutExportsDiagnostic1.ts_0_1383
// @module: preserve // @moduleResolution: bundler,node16 // @strict: true // @noTypesAndSymbols: true // @noEmit: true // @traceResolution: true // @Filename: /node_modules/foo/package.json { "name": "foo", "version": "1.0.0", "main": "index.js", "types": "index.d.ts", "exports": { ".": { ...
{ "end_byte": 1383, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolvesWithoutExportsDiagnostic1.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash2.ts_0_779
// @noTypesAndSymbols: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } } } // @Filename: /node_modules/@types/foo/index.d.mts export {}; declare global { const...
{ "end_byte": 779, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeTripleSlash2.ts" }
TypeScript/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts_0_670
// @allowImportingTsExtensions: true // @noEmit: true // @moduleResolution: classic,node10,node16,nodenext,bundler // @jsx: preserve // @noTypesAndSymbols: true // @Filename: /ts.ts export {}; // @Filename: /tsx.tsx export {}; // @Filename: /dts.d.ts export {}; // @Filename: /b.ts import {} from "./ts.js"; import {...
{ "end_byte": 670, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts" }
TypeScript/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts_0_1314
// @module: esnext // @moduleResolution: bundler, node10, classic // @declaration: true // @emitDeclarationOnly: true // @Filename: /node_modules/@types/foo/package.json { "name": "@types/foo", "version": "1.0.0", "exports": { ".": { "import": "./index.d.mts", "require": "./index.d.cts" } }...
{ "end_byte": 1314, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts" }
TypeScript/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient.ts_0_384
// @noImplicitReferences: true // @currentDirectory: / // This tests that an ambient module declaration overrides an untyped import. // @filename: /node_modules/foo/index.js This file is not processed. // @filename: /declarations.d.ts declare module "foo" { export const x: number; } // @filename: /a.ts /// <refe...
{ "end_byte": 384, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient.ts" }
TypeScript/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts_0_750
// @moduleResolution: node16,nodenext,bundler // @noEmit: true // @noTypesAndSymbols: true // @traceResolution: true // @strict: true // @Filename: /node_modules/@restart/hooks/package.json { "name": "@restart/hooks", "version": "0.3.25", "main": "cjs/index.js", "types": "cjs/index.d.ts", "module":...
{ "end_byte": 750, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts" }
TypeScript/tests/cases/conformance/moduleResolution/node10AlternateResult_noResolution.ts_0_379
// @moduleResolution: node10 // @traceResolution: true // @noEmit: true // @noTypesAndSymbols: true // @Filename: /node_modules/pkg/package.json { "name": "pkg", "version": "1.0.0", "exports": { ".": "./definitely-not-index.js" } } // @Filename: /node_modules/pkg/definitely-not-index.d.ts expo...
{ "end_byte": 379, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/node10AlternateResult_noResolution.ts" }
TypeScript/tests/cases/conformance/moduleResolution/importFromDot.ts_0_177
// @module: commonjs // @Filename: a.ts export const rootA = 0; // @Filename: a/index.ts export const indexInA = 0; // @Filename: a/b.ts import { indexInA, rootA } from ".";
{ "end_byte": 177, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/importFromDot.ts" }
TypeScript/tests/cases/conformance/moduleResolution/packageJsonMain.ts_0_587
// @noImplicitReferences: true // @currentDirectory: / // @traceResolution: true // @filename: /node_modules/foo/package.json { "main": "oof" } // @filename: /node_modules/foo/oof.js module.exports = 0; // @filename: /node_modules/bar/package.json { "main": "rab.js" } // @filename: /node_modules/bar/rab.js module.e...
{ "end_byte": 587, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/packageJsonMain.ts" }
TypeScript/tests/cases/conformance/moduleResolution/packageJsonMain_isNonRecursive.ts_0_327
// @noImplicitReferences: true // @currentDirectory: / // @traceResolution: true // @filename: /node_modules/foo/package.json { "main": "oof" } // @filename: /node_modules/foo/oof/package.json { "main": "ofo" } // @filename: /node_modules/foo/oof/ofo.js module.exports = 0; // @filename: /a.ts import foo = require("...
{ "end_byte": 327, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/packageJsonMain_isNonRecursive.ts" }
TypeScript/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts_0_203
// @moduleResolution: classic, node, node16, nodenext, bundler // @resolvePackageJsonImports: true // @resolvePackageJsonExports: true // @noTypesAndSymbols: true // @noEmit: true // @Filename: index.ts
{ "end_byte": 203, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts" }
TypeScript/tests/cases/conformance/moduleResolution/typesVersions.ambientModules.ts_0_779
// @traceResolution: true // @target: esnext // @module: commonjs // @noImplicitReferences: true // @filename: node_modules/ext/package.json { "name": "ext", "version": "1.0.0", "types": "index", "typesVersions": { ">=3.1.0-0": { "*" : ["ts3.1/*"] } } } // @filename: node_modules/ext/index....
{ "end_byte": 779, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/typesVersions.ambientModules.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts_0_293
// @moduleResolution: bundler // @module: esnext, preserve // @Filename: /esm.mts export const esm = 0; // @Filename: /not-actually-cjs.cts import { esm } from "./esm.mjs"; // @Filename: /package.json { "type": "commonjs" } // @Filename: /still-not-cjs.ts import { esm } from "./esm.mjs";
{ "end_byte": 293, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts_0_755
// @moduleResolution: bundler // @module: esnext, preserve // @checkJs: true // @allowJs: true // @outDir: out // @Filename: /node_modules/@types/node/index.d.ts declare var require: (...args: any[]) => any; // @Filename: /ambient.d.ts declare module "fs" { export function readFileSync(path: string, encoding?: st...
{ "end_byte": 755, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts_0_730
// @moduleResolution: bundler // @module: esnext, preserve // @traceResolution: true // @Filename: /dir/index.ts export const x = 0; // @Filename: /redirect/package.json { "main": "../foo" } // @Filename: /foo/index.ts export const y = 0; // @Filename: /types/esm.d.ts declare const _: string; export default _; // ...
{ "end_byte": 730, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerOptionsCompat.ts_0_194
// @noTypesAndSymbols: true // @Filename: /tsconfig.json { "compilerOptions": { "module": "commonjs", "moduleResolution": "bundler", "noEmit": true } } // @Filename: /index.ts
{ "end_byte": 194, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerOptionsCompat.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts_0_760
// @moduleResolution: bundler // @module: esnext, preserve // @traceResolution: true // @Filename: /node_modules/conditions/package.json { "name": "conditions", "version": "1.0.0", "type": "module", "main": "index.cjs", "types": "index.d.cts", "exports": { ".": { "node": "./index....
{ "end_byte": 760, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerDirectoryModule.ts_0_433
// @module: nodenext // @moduleResolution: nodenext,bundler // @noImplicitAny: true // @noEmit: true // @traceResolution: true // @noTypesAndSymbols: true // @noImplicitReferences: true // @Filename: /lib/package.json { "main": "./cjs/index.js" } // @Filename: /lib/cjs/index.js export function test() {} // @Filena...
{ "end_byte": 433, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerDirectoryModule.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts_0_784
// @moduleResolution: bundler // @module: esnext, preserve // @traceResolution: true // @Filename: /node_modules/dual/package.json { "name": "dual", "version": "1.0.0", "type": "module", "main": "index.cjs", "types": "index.d.cts", "exports": { ".": { "import": "./index.js", "require": "./i...
{ "end_byte": 784, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts" }
TypeScript/tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts_0_1454
// @moduleResolution: bundler // @module: esnext // @outDir: dist // @allowJs: true // @checkJs: true // @outDir: out // @noEmit: true,false // @allowImportingTsExtensions: true,false // @traceResolution: true // @Filename: /project/a.ts export {}; // @Filename: /project/b.ts export {}; // @Filename: /project/b.js e...
{ "end_byte": 1454, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts_0_387
// @declaration: true function takeObject(o: object) {} function returnObject(): object { return {}; } var nonPrimitive: object; var primitive: boolean; takeObject(nonPrimitive); nonPrimitive = returnObject(); takeObject(primitive); // expect error primitive = returnObject(); // expect error function returnErro...
{ "end_byte": 387, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts_0_347
// @strict: true // Repros from #23800 type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; }; type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; }; let a: A<{ a: 0 | 1 }, 0> = { a: 0 }; let b: B<{ a: 0 | 1 }, 0> = { a: 0 }; function foo<T, U>(x: T) { let a: object = x; // Error let b: U...
{ "end_byte": 347, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts_0_786
// @declaration: true function generic<T>(t: T) { var o: object = t; // expect error } var a = {}; var b = "42"; generic<object>({}); generic<object>(a); generic<object>(123); // expect error generic<object>(b); // expect error function bound<T extends object>(t: T) { var o: object = t; // ok } bound({}); bo...
{ "end_byte": 786, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts_0_63
var a: object; for (var key in a) { var value = a[key]; }
{ "end_byte": 63, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts_0_63
var x = {}; var y = {foo: "bar"}; var a: object; a = x; a = y;
{ "end_byte": 63, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts_0_1112
// @strictNullChecks: true var a: object declare var b: object | null declare var c: object | undefined declare var d: object | null | undefined var e: object | null a.toString; // error a = undefined; // error a = null; // error a = b; // error a = c; // error a = d; // error e = a; // ok a = e; // ok if (typeof b ...
{ "end_byte": 1112, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndEmptyObject.ts_0_259
// @strict: true // @declaration: true // Repro from #49480 export interface BarProps { barProp?: string; } export interface FooProps { fooProps?: BarProps & object; } declare const foo: FooProps; const { fooProps = {} } = foo; fooProps.barProp;
{ "end_byte": 259, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndEmptyObject.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts_0_128
// @noImplicitAny: true // @suppressImplicitAnyIndexErrors: true var a: object; for (var key in a) { var value = a[key]; }
{ "end_byte": 128, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts_0_327
class Narrow { narrowed: boolean } var a: object if (a instanceof Narrow) { a.narrowed; // ok a = 123; // error } if (typeof a === 'number') { a.toFixed(); // error, never } var b: object | null if (typeof b === 'object') { b.toString(); // ok, object | null } else { b.toString(); // error, n...
{ "end_byte": 327, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts_0_264
// @declaration: true var a: object & string = ""; // error var b: object | string = ""; // ok var c: object & {} = 123; // error a = b; // error b = a; // ok const foo: object & {} = {bar: 'bar'}; // ok const bar: object & {err: string} = {bar: 'bar'}; // error
{ "end_byte": 264, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts_0_116
var a: object; a.toString(); a.nonExist(); // error var { destructuring } = a; // error var { ...rest } = a; // ok
{ "end_byte": 116, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts_0_176
// @declaration: true interface WithNonPrimitive { foo: object } var a: WithNonPrimitive = { foo: {bar: "bar"} }; var b: WithNonPrimitive = {foo: "bar"}; // expect error
{ "end_byte": 176, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveRhsSideOfInExpression.ts_0_106
let o: object = {}; function f(): object { return {}; } const b1 = "foo" in o; const b2 = "bar" in f();
{ "end_byte": 106, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveRhsSideOfInExpression.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts_0_96
// @noImplicitAny: true var a: object; for (var key in a) { var value = a[key]; // error }
{ "end_byte": 96, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts_0_964
// @strict: true // test for #15371 function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void { tp = s; } function g<T extends null, P extends keyof T>(s: string, tp: T[P]): void { tp = s; } function h<T extends undefined, P extends keyof T>(s: string, tp: T[P]): void { tp = s; } function i...
{ "end_byte": 964, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts" }
TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts_0_420
var x = {}; var y = {foo: "bar"}; var a: object; x = a; y = a; // expect error a = x; a = y; var n = 123; var b = true; var s = "fooo"; a = n; // expect error a = b; // expect error a = s; // expect error n = a; // expect error b = a; // expect error s = a; // expect error var numObj: Number = 123; var boolObj: Boo...
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts_0_497
// it is an error to use a generic type without type arguments // all of these are errors declare class C<T> { foo: T; } declare var c: C; declare var a: { x: C }; declare var b: { (x: C): C }; declare var d: { [x: C]: C }; declare function f(x: C): C; declare class D extends C {} declare module M { expo...
{ "end_byte": 497, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts_0_631
// it is an error to use a generic type without type arguments // all of these are errors interface I<T> { foo: T; } var c: I; var a: { x: I }; var b: { (x: I): I }; var d: { [x: I]: I }; var e = (x: I) => { var y: I; return y; } function f(x: I): I { var y: I; return y; } var g = function f(x: I): I { var y...
{ "end_byte": 631, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts_0_497
// it is an error to use a generic type without type arguments // all of these are errors declare class C<T> { foo: T; } declare var c: C; declare var a: { x: C }; declare var b: { (x: C): C }; declare var d: { [x: C]: C }; declare function f(x: C): C; declare class D extends C {} declare module M { expo...
{ "end_byte": 497, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments.ts_0_410
// Check that errors are reported for non-generic types with type arguments class C { } interface I { } enum E { } type T = { }; var v1: C<string>; var v2: I<string>; var v3: E<string>; var v4: T<string>; function f<U>() { class C { } interface I { } enum E { } type T = {}; var v1: C<string>; ...
{ "end_byte": 410, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts_0_619
// it is an error to use a generic type without type arguments // all of these are errors class C<T> { foo: T; } var c: C; var a: { x: C }; var b: { (x: C): C }; var d: { [x: C]: C }; var e = (x: C) => { var y: C; return y; } function f(x: C): C { var y: C; return y; } var g = function f(x: C): C { var y: C;...
{ "end_byte": 619, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts_0_105
// it is an error to use a predefined type as a type name class void {} // parse error unlike the others
{ "end_byte": 105, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts_0_178
// it is an error to use a predefined type as a type name class any { } class number { } class boolean { } class bool { } // not a predefined type anymore class string { }
{ "end_byte": 178, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts_0_561
// basic valid forms of union literals var simpleUnion: string | number; var unionOfUnion: string | number | boolean; var arrayOfUnions: (string | number)[]; var arrayOfUnions: Array<string | number>; var unionOfFunctionType: (() => string) | (() => number); var unionOfFunctionType: { (): string } | { (): number }; ...
{ "end_byte": 561, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts_0_457
// basic uses of function literals with constructor overloads class C { constructor(x: string); constructor(x: number); constructor(x) { } } class D<T> { constructor(x: string); constructor(x: number); constructor(x) { } } var f: { new(x: string): C; new(x: number): C; } = C; var f2:...
{ "end_byte": 457, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteral.ts_0_265
// basic valid forms of function literals var x = () => 1; var x: { (): number; } var y: { (x: string): string; }; var y: (x: string) => string; var y2: { <T>(x: T): T; } = <T>(x: T) => x var z: { new (x: number): number; }; var z: new (x: number) => number;
{ "end_byte": 265, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteral.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts_0_630
// valid uses of arrays of function types var x = [() => 1, () => { }]; var r2 = x[0](); class C { foo: string; } var y = [C, C]; var r3 = new y[0](); var a: { (x: number): number; (x: string): string; }; var b: { (x: number): number; (x: string): string; }; var c: { (x: number): number; (x: any): any; }; var z ...
{ "end_byte": 630, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes.ts_0_289
// valid uses of arrays of function types var x: () => string[]; var r = x[1]; var r2 = r(); var r2b = new r(); var x2: { (): string }[]; var r3 = x2[1]; var r4 = r3(); var r4b = new r3(); // error var x3: Array<() => string>; var r5 = x2[1]; var r6 = r5(); var r6b = new r5(); // error
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes2.ts_0_285
// valid uses of arrays of function types var x: new () => string[]; var r = x[1]; var r2 = new r(); var r2b = r(); var x2: { new(): string }[]; var r3 = x[1]; var r4 = new r3(); var r4b = new r3(); var x3: Array<new () => string>; var r5 = x2[1]; var r6 = new r5(); var r6b = r5();
{ "end_byte": 285, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes2.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts_0_208
// array type cannot use typeof. var x = 1; var xs: typeof x[]; // Not an error. This is equivalent to Array<typeof x> var xs2: typeof Array; var xs3: typeof Array<number>; var xs4: typeof Array<typeof x>;
{ "end_byte": 208, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads.ts_0_346
// basic uses of function literals with overloads var f: { (x: string): string; (x: number): number; } = (x) => x; var f2: { <T>(x: string): string; <T>(x: number): number; } = (x) => x; var f3: { <T>(x: T): string; <T>(x: T): number; } = (x) => x; var f4: { <T>(x: string): T; <T>(x:...
{ "end_byte": 346, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayLiteral.ts_0_274
// valid uses of array literals var x = []; var x = new Array(1); var y = [1]; var y = [1, 2]; var y = new Array<number>(); var x2: number[] = []; var x2: number[] = new Array(1); var y2: number[] = [1]; var y2: number[] = [1, 2]; var y2: number[] = new Array<number>();
{ "end_byte": 274, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayLiteral.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeLiterals/parenthesizedTypes.ts_0_845
var a: string; var a: (string); var a: ((string) | string | (((string)))); var a: ((((((((((((((((((((((((((((((((((((((((string)))))))))))))))))))))))))))))))))))))))); var b: (x: string) => string; var b: ((x: (string)) => (string)); var c: string[] | number[]; var c: (string)[] | (number)[]; var c: ((string)[]) | ...
{ "end_byte": 845, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeLiterals/parenthesizedTypes.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClassWithPrivates.ts_0_148
class C<T> { private a: number; private static b: number; x: T; static y: T; } var c: C<string>; var r: typeof C; var r2: typeof c;
{ "end_byte": 148, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClassWithPrivates.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts_0_291
class Controller { create() { } delete() { } var() { } } interface IScope { create: typeof Controller.prototype.create; delete: typeof Controller.prototype.delete; // Should not error var: typeof Controller.prototype.var; // Should not error }
{ "end_byte": 291, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts_0_86
module M { var x = 1; class C { foo: number; } } var r: typeof M;
{ "end_byte": 86, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts_0_836
export var x = 1; export var r1: typeof x; export var y = { foo: '' }; export var r2: typeof y; export class C { foo: string; } export var c: C; var c2: C; export var r3: typeof C; export var r4: typeof c; export var r4b: typeof c2; export interface I { foo: string; } export var i: I; var i2: I; export var r5...
{ "end_byte": 836, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts_0_2584
// @noImplicitThis: true // @strict: true class Test { data = {}; constructor() { var copy: typeof this.data = {}; } } class Test1 { data = { foo: '' }; ['this'] = ''; constructor() { var copy: typeof this.data = { foo: '' }; var foo: typeof this.data.foo = ''; ...
{ "end_byte": 2584, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts_0_532
type typeAlias1 = typeof varOfAliasedType1; var varOfAliasedType1: typeAlias1; var varOfAliasedType2: typeAlias2; type typeAlias2 = typeof varOfAliasedType2; function func(): typeAlias3 { return null; } var varOfAliasedType3 = func(); type typeAlias3 = typeof varOfAliasedType3; // Repro from #26104 interface Input ...
{ "end_byte": 532, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts_0_735
class C<T> { constructor(x: number); constructor(x: string); constructor(public x) { } static foo(x: number); static foo(x: {}); static foo(x) { } static bar(x) { } static sa = 1; static sb = () => 1; static get sc() { return 1; } static set sc(x) { } ...
{ "end_byte": 735, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts_0_1244
// The following are errors because of circular references var c: typeof c; var c: any; var d: typeof e; var d: any; var e: typeof d; var e: any; interface Foo<T> { } var f: Array<typeof f>; var f: any; var f2: Foo<typeof f2>; var f2: any; var f3: Foo<typeof f3>[]; var f3: any; // None of these declarations should ha...
{ "end_byte": 1244, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts_0_773
var x = 1; export var r1: typeof x; var y = { foo: '' }; export var r2: typeof y; class C { foo: string; } export var c: C; var c2: C; export var r3: typeof C; export var r4: typeof c; export var r4b: typeof c2; interface I { foo: string; } export var i: I; var i2: I; export var r5: typeof i; export var r5: t...
{ "end_byte": 773, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts_0_78
// @noImplicitThis: false function Test1() { let x: typeof this.no = 1 }
{ "end_byte": 78, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/invalidTypeOfTarget.ts_0_175
var x1: typeof {}; var x2: typeof (): void; var x3: typeof 1; var x4: typeof ''; var x5: typeof []; var x6: typeof null; var x7: typeof function f() { }; var x8: typeof /123/;
{ "end_byte": 175, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/invalidTypeOfTarget.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts_0_300
class C { constructor(x: number); constructor(x: string); constructor(x) { } static foo(x: number); static foo(x: C); static foo(x) { } static bar(x) { } } class D extends C { static baz(x: number) { } foo() { } } var d: D; var r1: typeof D; var r2: typeof d;
{ "end_byte": 300, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts" }
TypeScript/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofTypeParameter.ts_0_82
function f<T>(x: T): T { var a: typeof x; var y: typeof T; return a; }
{ "end_byte": 82, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofTypeParameter.ts" }
TypeScript/tests/cases/conformance/types/witness/witness.ts_4_2361
// Initializers var varInit = varInit; // any var pInit: any; function fn(pInit = pInit) { var pInit: any; } class InitClass { x = this.x; fn() { var y = this.x; var y: any; } } // Return type function fnReturn1() { return fnReturn1(); } var a: any; var a = fnReturn1(); function fn...
{ "end_byte": 2361, "start_byte": 4, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/witness/witness.ts" }
TypeScript/tests/cases/conformance/types/literal/literalTypeWidening.ts_0_3671
// Widening vs. non-widening literal types function f1() { const c1 = "hello"; // Widening type "hello" let v1 = c1; // Type string const c2 = c1; // Widening type "hello" let v2 = c2; // Type string const c3: "hello" = "hello"; // Type "hello" let v3 = c3; // Type "hello" const c4: "...
{ "end_byte": 3671, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/literalTypeWidening.ts" }
TypeScript/tests/cases/conformance/types/literal/numericLiteralTypes3.ts_0_1320
type A = 1; type B = 2 | 3; type C = 1 | 2 | 3; type D = 0 | 1 | 2; function f1(a: A, b: B, c: C, d: D) { a = a; a = b; a = c; a = d; } function f2(a: A, b: B, c: C, d: D) { b = a; b = b; b = c; b = d; } function f3(a: A, b: B, c: C, d: D) { c = a; c = b; c = c; c = d;...
{ "end_byte": 1320, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/numericLiteralTypes3.ts" }
TypeScript/tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts_3_206
pe EnhancedString = string & { enhancements: any }; var a = "foo" === "bar" as "baz"; var b = "foo" !== ("bar" as "foo"); var c = "foo" == (<number>"bar"); var d = "foo" === ("bar" as EnhancedString);
{ "end_byte": 206, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts" }
TypeScript/tests/cases/conformance/types/literal/stringMappingDeferralInConditionalTypes.ts_0_638
// @strict: true // @noEmit: true // https://github.com/microsoft/TypeScript/issues/55847 type A<S> = Lowercase<S & string> extends "foo" ? 1 : 0; let x1: A<"foo"> = 1; // ok type B<S> = Lowercase<S & string> extends `f${string}` ? 1 : 0; let x2: B<"foo"> = 1; // ok type C<S> = Capitalize<Lowercase<S & string>> ext...
{ "end_byte": 638, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/stringMappingDeferralInConditionalTypes.ts" }
TypeScript/tests/cases/conformance/types/literal/stringEnumLiteralTypes3.ts_0_2303
const enum Choice { Unknown = "", Yes = "yes", No = "no" }; type Yes = Choice.Yes; type YesNo = Choice.Yes | Choice.No; type NoYes = Choice.No | Choice.Yes; type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No; function f1(a: Yes, b: YesNo, c: UnknownYesNo, d: Choice) { a = a; a = b; a = c; a =...
{ "end_byte": 2303, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/stringEnumLiteralTypes3.ts" }
TypeScript/tests/cases/conformance/types/literal/stringEnumLiteralTypes2.ts_0_1910
// @strictNullChecks: true const enum Choice { Unknown = "", Yes = "yes", No = "no" }; type YesNo = Choice.Yes | Choice.No; type NoYes = Choice.No | Choice.Yes; type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No; function f1() { var a: YesNo; var a: NoYes; var a: Choice.Yes | Choice.No; var ...
{ "end_byte": 1910, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/stringEnumLiteralTypes2.ts" }
TypeScript/tests/cases/conformance/types/literal/literalTypes1.ts_0_1413
// @strictNullChecks: true let zero: 0 = 0; let one: 1 = 1; let two: 2 = 2; let oneOrTwo: 1 | 2 = <1 | 2>1; function f1(x: 0 | 1 | 2) { switch (x) { case zero: x; break; case one: x; break; case two: x; break; ...
{ "end_byte": 1413, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/literalTypes1.ts" }
TypeScript/tests/cases/conformance/types/literal/numericLiteralTypes2.ts_0_2301
// @strictNullChecks: true type A1 = 1; type A2 = 1.0; type A3 = 1e0; type A4 = 10e-1; type A5 = 1 | 1.0 | 1e0 | 10e-1; function f1() { var a: A1 = 1; var a: A2 = 1; var a: A3 = 1; var a: A4 = 1; var a: A5 = 1; } type B1 = -1 | 0 | 1; type B2 = 1 | 0 | -1; type B3 = 0 | -1 | 1; function f2() { ...
{ "end_byte": 2301, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/numericLiteralTypes2.ts" }
TypeScript/tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements01.ts_3_156
t x: "foo"; let y: "foo" | "bar"; switch (x) { case "foo": break; case "bar": break; case y: y; break; }
{ "end_byte": 156, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements01.ts" }
TypeScript/tests/cases/conformance/types/literal/booleanLiteralTypes2.ts_0_1615
// @strictNullChecks: true type A1 = true | false; type A2 = false | true; function f1() { var a: A1; var a: A2; var a: true | false; var a: false | true; } function f2(a: true | false, b: boolean) { a = b; b = a; } function f3(a: true | false, b: true | false) { var x = a || b; var ...
{ "end_byte": 1615, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/types/literal/booleanLiteralTypes2.ts" }