_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts_0_489
class Point { constructor(public x: number, public y: number) { } static Origin(): Point { return { x: 0, y: 0 }; } } module Point { function Origin() { return ""; }// not an error, since not exported } module A { export class Point { constructor(public x: number, public y: number) { } ...
{ "end_byte": 489, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts" }
TypeScript/tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts_0_243
// expected no error module B { export import a = A; export class D extends a.C { id: number; } } module A { export class C { name: string } export import b = B; } var c: { name: string }; var c = new B.a.C();
{ "end_byte": 243, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts" }
TypeScript/tests/cases/conformance/internalModules/importDeclarations/importAliasIdentifiers.ts_0_760
module moduleA { export class Point { constructor(public x: number, public y: number) { } } } import alias = moduleA; var p: alias.Point; var p: moduleA.Point; var p: { x: number; y: number; }; class clodule { name: string; } module clodule { export interface Point { x: number; y: nu...
{ "end_byte": 760, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/internalModules/importDeclarations/importAliasIdentifiers.ts" }
TypeScript/tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts_0_224
// none of these should work, since non are actually modules var V = 12; import v = V; class C { name: string; } import c = C; enum E { Red, Blue } import e = E; interface I { id: number; } import i = I;
{ "end_byte": 224, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts" }
TypeScript/tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts_0_772
// all errors imported modules conflict with local variables module A { export var Point = { x: 0, y: 0 } export interface Point { x: number; y: number; } } module B { var A = { x: 0, y: 0 }; import Point = A; } module X { export module Y { export interface Point{ ...
{ "end_byte": 772, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts" }
TypeScript/tests/cases/conformance/internalModules/importDeclarations/exportImportAlias.ts_0_1149
// expect no errors here module A { export var x = 'hello world' export class Point { constructor(public x: number, public y: number) { } } export module B { export interface Id { name: string; } } } module C { export import a = A; } var a: string = C.a.x;...
{ "end_byte": 1149, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/internalModules/importDeclarations/exportImportAlias.ts" }
TypeScript/tests/cases/conformance/jsdoc/overloadTag2.ts_0_772
// @checkJs: true // @allowJs: true // @target: esnext // @outdir: foo // @declaration: true // @filename: overloadTag2.js // @strict: true export class Foo { #a = true ? 1 : "1" #b /** * Should not have an implicit any error, because constructor's return type is always implicit * @constructor ...
{ "end_byte": 772, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/overloadTag2.ts" }
TypeScript/tests/cases/conformance/jsdoc/paramTagTypeResolution2.ts_0_241
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: 38572.js /** * @template T * @param {T} a * @param {{[K in keyof T]: (value: T[K]) => void }} b */ function f(a, b) { } f({ x: 42 }, { x(param) { param.toFixed() } });
{ "end_byte": 241, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/paramTagTypeResolution2.ts" }
TypeScript/tests/cases/conformance/jsdoc/importTag19.ts_0_246
// @declaration: true // @emitDeclarationOnly: true // @checkJs: true // @allowJs: true // @filename: a.ts export interface Foo {} // @filename: b.js /** * @import { Foo } * from "./a" */ /** * @param {Foo} a */ export function foo(a) {}
{ "end_byte": 246, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/importTag19.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocImplements_interface_multiple.ts_0_503
// @allowJs: true // @checkJs: true // @declaration: true // @emitDeclarationOnly: true // @outDir: ./out // @Filename: /defs.d.ts interface Drawable { draw(): number; } interface Sizable { size(): number; } // @Filename: /a.js /** * @implements {Drawable} * @implements Sizable **/ class Square { dra...
{ "end_byte": 503, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocImplements_interface_multiple.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTemplateTag3.ts_0_759
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: a.js /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? * @template W * @template X That last one had no comment * @param {T} t * @param {U} u * @param {V} v * @param {W} ...
{ "end_byte": 759, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTemplateTag3.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocReturnTag1.ts_0_414
// @allowJs: true // @outFile: dummy.js // @filename: returns.js // @ts-check /** * @returns {string} This comment is not currently exposed */ function f() { return "hello"; } /** * @returns {string=} This comment is not currently exposed */ function f1() { return "hello world"; } /** * @returns {string...
{ "end_byte": 414, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocReturnTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocParseDotDotDotInJSDocFunction.ts_0_306
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js // from bcryptjs /** @param {function(...[*])} callback */ function g(callback) { callback([1], [2], [3]) } /** * @type {!function(...number):string} * @inner */ var stringFromCharCode = String.fromCharCode;
{ "end_byte": 306, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocParseDotDotDotInJSDocFunction.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocFunction_missingReturn.ts_0_141
// @allowJs: true // @checkJs: true // @noEmit: true // @strict: true // @Filename: /a.js /** @type {function(): number} */ function f() {}
{ "end_byte": 141, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocFunction_missingReturn.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocPrefixPostfixParsing.ts_0_958
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: true // @noImplicitAny: true // @Filename: prefixPostfix.js /** * @param {number![]} x - number[] * @param {!number[]} y - number[] * @param {(number[])!} z - number[] * @param {number?[]} a - parse error without parentheses * @param {?nu...
{ "end_byte": 958, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocPrefixPostfixParsing.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag9.ts_0_460
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} Color * @property {number} r * @property {number} g * @property {number} b */ // All of these should be Colors, but I only use some of them here. export const Palette = /** @satisfies {Record<string, Color>} */ ({ ...
{ "end_byte": 460, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag9.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocParseBackquotedParamName.ts_0_271
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js /** * @param {string=} `args` * @param `bwarg` {?number?} */ function f(args, bwarg) { } // @Filename: ts.ts /** * @param `arg` - this is fine */ function g(arg: string) { }
{ "end_byte": 271, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocParseBackquotedParamName.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocIndexSignature.ts_0_331
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: indices.js /** @type {Object.<string, number>} */ var o1; /** @type {Object.<number, boolean>} */ var o2; /** @type {Object.<boolean, string>} */ var o3; /** @param {Object.<string, boolean>} o */ function f(o) { o.foo = 1; // error o.bar = fals...
{ "end_byte": 331, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocIndexSignature.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocParseParenthesizedJSDocParameter.ts_0_161
// @noemit: true // @allowjs: true // @checkjs: true // @strict: true // @Filename: paren.js /** @type {function((string)): string} */ var x = s => s.toString()
{ "end_byte": 161, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocParseParenthesizedJSDocParameter.ts" }
TypeScript/tests/cases/conformance/jsdoc/seeTag1.ts_0_235
// @declaration: true interface Foo { foo: string } namespace NS { export interface Bar { baz: Foo } } /** @see {Foo} foooo*/ const a = "" /** @see {NS.Bar} ns.bar*/ const b = "" /** @see {b} b */ const c = ""
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/seeTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/extendsTagEmit.ts_0_214
// @allowJs: true // @checkJs: true // @target: esnext // @outDir: out // @Filename: super.js export class B { } // @Filename: main.js import { B } from './super' /** @extends {Mismatch} */ class C extends B { }
{ "end_byte": 214, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/extendsTagEmit.ts" }
TypeScript/tests/cases/conformance/jsdoc/syntaxErrors.ts_0_351
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: dummyType.d.ts declare class C<T> { t: T } // @Filename: badTypeArguments.js /** @param {C.<>} x */ /** @param {C.<number,>} y */ // @ts-ignore /** @param {C.<number,>} skipped */ function f(x, y, skipped) { return x.t + y.t; } var x = f({ t: 1000...
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/syntaxErrors.ts" }
TypeScript/tests/cases/conformance/jsdoc/callbackTag1.ts_0_397
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: cb.js /** @callback Sid * @param {string} s * @returns {string} What were you expecting */ var x = 1 /** @type {Sid} smallId */ var sid = s => s + "!"; /** @type {NoReturn} */ var noreturn = obj => void obj.title /** * @callback NoReturn * @pa...
{ "end_byte": 397, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/callbackTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeReferenceExports.ts_0_133
// @allowJs: true // @noEmit: true // @checkJs: true // @Filename: bug27342.js module.exports = {} /** * @type {exports} */ var x
{ "end_byte": 133, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeReferenceExports.ts" }
TypeScript/tests/cases/conformance/jsdoc/thisTag3.ts_0_223
// @allowJs: true // @checkJs: true // @noEmit: true // @filename: /a.js /** * @typedef {{fn(a: string): void}} T */ class C { /** * @this {T} * @param {string} a */ p = (a) => this.fn("" + a); }
{ "end_byte": 223, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/thisTag3.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeReferenceToValue.ts_0_157
// @Filename: foo.js // @noEmit: true // @allowJs: true // @checkJs: true /** @param {Image} image */ function process(image) { return new image(1, 1) }
{ "end_byte": 157, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeReferenceToValue.ts" }
TypeScript/tests/cases/conformance/jsdoc/tsNoCheckForTypescriptComments1.ts_0_376
// @declaration: true // @filename: file.ts // @ts-nocheck additional comments export const a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export interface Aleph { q: number; } export class Bet implements Aleph { q:...
{ "end_byte": 376, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/tsNoCheckForTypescriptComments1.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocTypeTag4.ts_0_292
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: t.d.ts type A<T extends string> = { a: T } // @Filename: test.js /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B */ /** @type {A<number>} */ var a; /** @type {B<number>} */ var b;
{ "end_byte": 292, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocTypeTag4.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocLinkTag8.ts_0_151
// @checkJs: true // @allowJs: true // @target: esnext // @noEmit: true // @filename: /a.js /** {@link Map.delete} */ const remove = (map, key) => {}
{ "end_byte": 151, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocLinkTag8.ts" }
TypeScript/tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.ts_0_160
// @allowJS: true // @checkJS: true // @noEmit: true // @Filename: typedefDuplicateTypeDeclaration.js /** * @typedef Name * @type {string} * @type {Oops} */
{ "end_byte": 160, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocImplements_interface.ts_0_375
// @allowJs: true // @checkJs: true // @declaration: true // @emitDeclarationOnly: true // @outDir: ./out // @Filename: /defs.d.ts interface A { mNumber(): number; } // @Filename: /a.js /** @implements A */ class B { mNumber() { return 0; } } /** @implements {A} */ class B2 { mNumber() { ...
{ "end_byte": 375, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocImplements_interface.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts_0_277
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js /** * @template const T * @typedef {[T]} X */ /** * @template const T */ class C { } /** * @template private T * @param {T} x * @returns {T} */ function f(x) { return x; }
{ "end_byte": 277, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts" }
TypeScript/tests/cases/conformance/jsdoc/typedefTagNested.ts_0_790
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js /** @typedef {Object} App * @property {string} name * @property {Object} icons * @property {string} icons.image32 * @property {string} icons.image64 */ var ex; /** @type {App} */ const app = { name: 'name', icons: { ...
{ "end_byte": 790, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typedefTagNested.ts" }
TypeScript/tests/cases/conformance/jsdoc/thisPrototypeMethodCompoundAssignment.ts_0_119
// @strict: true // @noEmit: true Element.prototype.remove ??= function () { this.parentNode?.removeChild(this); };
{ "end_byte": 119, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/thisPrototypeMethodCompoundAssignment.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocOuterTypeParameters1.ts_0_259
// @checkjs: true // @filename: jsdocOuterTypeParameters1.js /** @return {T} */ const dedupingMixin = function(mixin) {}; /** @template {T} */ const PropertyAccessors = dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } } });
{ "end_byte": 259, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocOuterTypeParameters1.ts" }
TypeScript/tests/cases/conformance/jsdoc/moduleExportsElementAccessAssignment.ts_0_414
// @allowJs: true // @strict: true // @checkJs: true // @emitDeclarationOnly: true // @declaration: true // @filename: mod1.js exports.a = { x: "x" }; exports["b"] = { x: "x" }; exports["default"] = { x: "x" }; module.exports["c"] = { x: "x" }; module["exports"]["d"] = {}; module["exports"]["d"].e = 0; // @filename: m...
{ "end_byte": 414, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/moduleExportsElementAccessAssignment.ts" }
TypeScript/tests/cases/conformance/jsdoc/constructorTagOnObjectLiteralMethod.ts_0_190
// @noEmit: true // @Filename: example.js // @allowJs: true // @checkJs: true // @noImplicitAny: true const obj = { /** @constructor */ Foo() { this.bar = "bar" } }; (new obj.Foo()).bar
{ "end_byte": 190, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/constructorTagOnObjectLiteralMethod.ts" }
TypeScript/tests/cases/conformance/jsdoc/typeTagNoErasure.ts_0_267
// @checkJs:true // @declaration: true // @outdir: out/ // @filename: typeTagNoErasure.js /** @template T @typedef {<T1 extends T>(data: T1) => T1} Test */ /** @type {Test<number>} */ const test = dibbity => dibbity test(1) // ok, T=1 test('hi') // error, T=number
{ "end_byte": 267, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typeTagNoErasure.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocTypedefInParamTag1.ts_3_737
@allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** * @typedef {Object} Opts * @property {string} x * @property {string=} y * @property {string} [z] * @property {string} [w="hi"] * * @param {Opts} opts */ function foo(opts) { opts.x; } foo({x: 'abc'}); /** * @typedef {O...
{ "end_byte": 737, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocTypedefInParamTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/returnTagTypeGuard.ts_0_1027
// @noEmit: true // @allowJs: true // @checkJs: true // @lib: esnext // @Filename: bug25127.js class Entry { constructor() { this.c = 1 } /** * @param {any} x * @return {this is Entry} */ isInit(x) { return true } } class Group { constructor() { this.d = 'n...
{ "end_byte": 1027, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/returnTagTypeGuard.ts" }
TypeScript/tests/cases/conformance/jsdoc/thisTag2.ts_0_193
// @target: esnext // @allowJs: true // @declaration: true // @emitDeclarationOnly: true // @filename: a.js /** @this {string} */ export function f1() {} /** @this */ export function f2() {}
{ "end_byte": 193, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/thisTag2.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocTypeTag5.ts_0_988
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: test.js // all 6 should error on return statement/expression /** @type {(x: number) => string} */ function h(x) { return x } /** @type {(x: number) => string} */ var f = x => x /** @type {(x: number) => string} */ var g = function (x) { return x } /** ...
{ "end_byte": 988, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocTypeTag5.ts" }
TypeScript/tests/cases/conformance/jsdoc/linkTagEmit1.ts_0_691
// @checkJs: true // @outdir: foo // @declaration: true // @filename: declarations.d.ts declare namespace NS { type R = number } // @filename: linkTagEmit1.js /** @typedef {number} N */ /** * @typedef {Object} D1 * @property {1} e Just link to {@link NS.R} this time * @property {1} m Wyatt Earp loved {@link N in...
{ "end_byte": 691, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/linkTagEmit1.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocReturnTag1.ts_0_382
// @allowJs: true // @filename: returns.js // @outFile: dummy.js /** * @returns {string} This comment is not currently exposed */ function f() { return 5; } /** * @returns {string=} This comment is not currently exposed */ function f1() { return 5; } /** * @returns {string|number} This comment is not cur...
{ "end_byte": 382, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocReturnTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocFunctionType.ts_0_1384
// @allowJs: true // @checkJs: true // @noEmit: true // @noImplicitAny: true // @Filename: functions.js /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} */ function id1(c) { return c } var x = id1(function (n) { return this.l...
{ "end_byte": 1384, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocFunctionType.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeTagCast.ts_0_1875
// @allowJS: true // @suppressOutputPathCheck: true // @strictNullChecks: true // @filename: a.ts var W: string; // @filename: b.js // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); var W = /** @type {string} */(4); // Error /** @type {*} */ var a; /** @type {string} */ var s; var a = /** @type {*...
{ "end_byte": 1875, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeTagCast.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts_0_1561
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js /** * @template const T * @param {T} x * @returns {T} */ function f1(x) { return x; } const t1 = f1("a"); const t2 = f1(["a", ["b", "c"]]); const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); /** * @template ...
{ "end_byte": 1561, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts" }
TypeScript/tests/cases/conformance/jsdoc/templateInsideCallback.ts_0_1003
// @checkJs: true // @strict: true // @outDir: dist/ // @declaration: true // @filename: templateInsideCallback.js /** * @typedef Oops * @template T * @property {T} a * @property {T} b */ /** * @callback Call * @template T * @param {T} x * @returns {T} */ /** * @template T * @type {Call<T>} */ const identi...
{ "end_byte": 1003, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/templateInsideCallback.ts" }
TypeScript/tests/cases/conformance/jsdoc/seeTag4.ts_0_188
// @checkJs: true // @allowJs: true // @outdir: out/ // @filename: seeTag4.js /** * @typedef {any} A */ /** * @see {@link A} * @see {@linkcode A} * @see {@linkplain A} */ let foo;
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/seeTag4.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkExportsObjectAssignPrototypeProperty.ts_0_1251
// @allowJs: true // @noEmit: true // @strict: true // @checkJs: true // @filename: mod1.js /** * @constructor * @param {string} name */ function Person(name) { this.name = name; } Person.prototype.describe = function () { return "Person called " + this.name; }; Object.defineProperty(Person.prototype, "thing...
{ "end_byte": 1251, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkExportsObjectAssignPrototypeProperty.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkOtherObjectAssignProperty.ts_0_810
// @allowJs: true // @noEmit: true // @strict: true // @checkJs: true // @filename: mod1.js const obj = { value: 42, writable: true }; Object.defineProperty(exports, "thing", obj); /** * @type {string} */ let str = /** @type {string} */("other"); Object.defineProperty(exports, str, { value: 42, writable: true }); ...
{ "end_byte": 810, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkOtherObjectAssignProperty.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocAugments_withTypeParameter.ts_0_213
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /a.d.ts declare class A<T> { x: T } // @Filename: /b.js /** @augments A<number> */ class B extends A { m() { return this.x; } }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocAugments_withTypeParameter.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction.ts_0_434
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: templateTagOnConstructorFunctions.js /** * @template U * @typedef {(u: U) => U} Id */ /** * @param {T} t * @template T */ function Zet(t) { /** @type {T} */ this.u this.t = t } /** * @param {T} v * @param {Id<T>} id */ Zet.prototyp...
{ "end_byte": 434, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction.ts" }
TypeScript/tests/cases/conformance/jsdoc/callbackTag4.ts_0_289
// @allowJs: true // @checkJs: true // @strict: true // @noEmit: true // @filename: ./a.js /** * @callback C * @this {{ a: string, b: number }} * @param {string} a * @param {number} b * @returns {boolean} */ /** @type {C} */ const cb = function (a, b) { this return true }
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/callbackTag4.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeReferenceToImportOfFunctionExpression.ts_0_455
// @noEmit: true // @allowjs: true // @checkjs: true // @Filename: MW.js /** @typedef {import("./MC")} MC */ class MW { /** * @param {MC} compiler the compiler */ constructor(compiler) { this.compiler = compiler; } } module.exports = MW; // @Filename: MC.js const MW = require("./MW"); /** @typedef ...
{ "end_byte": 455, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeReferenceToImportOfFunctionExpression.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocReadonly.ts_0_504
// @allowJs: true // @checkJs: true // @target: esnext // @noEmit: true // @Filename: jsdocReadonly.js class LOL { /** * @readonly * @private * @type {number} * Order rules do not apply to JSDoc */ x = 1 /** @readonly */ y = 2 /** @readonly Definitely not here */ static...
{ "end_byte": 504, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocReadonly.ts" }
TypeScript/tests/cases/conformance/jsdoc/paramTagOnFunctionUsingArguments.ts_0_443
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: decls.d.ts declare function factory(type: string): {}; // @Filename: a.js /** * @param {string} first */ function concat(/* first, second, ... */) { var s = '' for (var i = 0, l = arguments.length; i < l; i++) { s += argument...
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/paramTagOnFunctionUsingArguments.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocPostfixEqualsAddsOptionality.ts_0_376
// @Filename: a.js // @noEmit: true // @allowJs: true // @checkJs: true // @strict: true /** @param {number=} a */ function f(a) { a = 1 a = null // should not be allowed a = undefined } f() f(null) // should not be allowed f(undefined) f(1) /** @param {???!?number?=} a */ function g(a) { a = 1 a =...
{ "end_byte": 376, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocPostfixEqualsAddsOptionality.ts" }
TypeScript/tests/cases/conformance/jsdoc/overloadTag3.ts_0_323
// @checkJs: true // @allowJs: true // @strict: true // @noEmit: true // @filename: /a.js /** * @template T */ export class Foo { /** * @constructor * @overload */ constructor() { } /** * @param {T} value */ bar(value) { } } /** @type {Foo<number>} */ let foo; foo = new Foo(...
{ "end_byte": 323, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/overloadTag3.ts" }
TypeScript/tests/cases/conformance/jsdoc/enumTagImported.ts_0_442
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: type.js /** @typedef {import("./mod1").TestEnum} TE */ /** @type {TE} */ const test = 'add' /** @type {import("./mod1").TestEnum} */ const tost = 'remove' // @Filename: value.js import { TestEnum } from "./mod1" /** @type {TestEnum} */ const tist = Tes...
{ "end_byte": 442, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/enumTagImported.ts" }
TypeScript/tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.ts_0_1125
// @allowJs: true // @checkJs: true // @noEmit: true // @allowUnreachableCode: false // @filename: assertionsAndNonReturningFunctions.js /** @typedef {(check: boolean) => asserts check} AssertFunc */ /** @type {AssertFunc} */ const assert = check => { if (!check) throw new Error(); } /** @type {(x: unknown) => a...
{ "end_byte": 1125, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocTypeTag1.ts_3_599
@allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** @type {String} */ var S = "hello world"; /** @type {number} */ var n = 10; /** @type {*} */ var anyT = 2; anyT = "hello"; /** @type {?} */ var anyT1 = 2; anyT1 = "hi"; /** @type {Function} */ const x = (a) => a + 1; x(1); /** @t...
{ "end_byte": 599, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocTypeTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/typedefInnerNamepaths.ts_0_215
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: bug25104.js class C { /** * @typedef {C~A} C~B * @typedef {object} C~A */ /** @param {C~A} o */ constructor(o) { } }
{ "end_byte": 215, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typedefInnerNamepaths.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeReferenceToMergedClass.ts_0_336
// https://github.com/microsoft/TypeScript/issues/34685 // @noEmit: true // @allowJs: true // @checkJs: true // @Filename: jsdocTypeReferenceToMergedClass.js var Workspace = {} /** @type {Workspace.Project} */ var p; p.isServiceProject() Workspace.Project = function wp() { } Workspace.Project.prototype = { isServic...
{ "end_byte": 336, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeReferenceToMergedClass.ts" }
TypeScript/tests/cases/conformance/jsdoc/importTag18.ts_0_252
// @declaration: true // @emitDeclarationOnly: true // @checkJs: true // @allowJs: true // @filename: a.ts export interface Foo {} // @filename: b.js /** * @import { * Foo * } from "./a" */ /** * @param {Foo} a */ export function foo(a) {}
{ "end_byte": 252, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/importTag18.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTemplateTag2.ts_0_213
// @allowJs: true // @checkJs: true // @noEmit: true // @lib: dom,esnext // @Filename: github17339.js var obj = { /** * @template T * @param {T} a * @returns {T} */ x: function (a) { return a; }, };
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTemplateTag2.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag8.ts_0_238
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {Object.<string, boolean>} Facts */ // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ m: true, s: "false" })
{ "end_byte": 238, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag8.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocImplements_class.ts_0_852
// @allowJs: true // @checkJs: true // @declaration: true // @emitDeclarationOnly: true // @outDir: ./out // @Filename: /a.js class A { /** @return {number} */ method() { throw new Error(); } } /** @implements {A} */ class B { method() { return 0 } } /** @implements A */ class B2 { /** @return {stri...
{ "end_byte": 852, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocImplements_class.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocImportType.ts_0_524
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: types.d.ts declare function require(name: string): any; declare var exports: any; declare var module: { exports: any }; // @Filename: mod1.js /// <reference path='./types.d.ts'/> class Chunk { constructor() { this.chunk = 1; } } module.e...
{ "end_byte": 524, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocImportType.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment.ts_0_528
// @noEmit: true // @allowJs: true // @checkJs: true // @noImplicitAny: true // @Filename: a.js function A () { this.x = 1 /** @type {1} */ this.first = this.second = 1 } /** @param {number} n */ A.prototype.y = A.prototype.z = function f(n) { return n + this.x } /** @param {number} m */ A.s = A.t = fun...
{ "end_byte": 528, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocPrivateName2.ts_0_219
// @allowJs: true // @checkJs: true // @noEmit: true // @lib: dom,esnext // @Filename: jsdocPrivateName1.js // Expecting parse error for private field /** * @typedef A * @type {object} * @property {string} #id */
{ "end_byte": 219, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocPrivateName2.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocLiteral.ts_0_294
// @allowJs: true // @filename: in.js // @outFile: out.js /** * @param {'literal'} p1 * @param {"literal"} p2 * @param {'literal' | 'other'} p3 * @param {'literal' | number} p4 * @param {12 | true | 'str'} p5 */ function f(p1, p2, p3, p4, p5) { return p1 + p2 + p3 + p4 + p5 + '.'; }
{ "end_byte": 294, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocLiteral.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocBindingInUnreachableCode.ts_0_171
// @allowJs: true // @noEmit: true // @checkJs: true // @Filename: bug27341.js if (false) { /** * @param {string} s */ const x = function (s) { }; }
{ "end_byte": 171, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocBindingInUnreachableCode.ts" }
TypeScript/tests/cases/conformance/jsdoc/paramTagTypeResolution.ts_0_256
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: first.js /** @template T * @param {T} x * @param {(t: T) => void} k */ module.exports = function (x, k) { return k(x) } // @Filename: main.js var f = require('./first'); f(1, n => { })
{ "end_byte": 256, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/paramTagTypeResolution.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocParseStarEquals.ts_0_252
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js /** @param {...*=} args @return {*=} */ function f(...args) { return null } /** @type *= */ var x; /** @param {function():*=} f */ function cbf(f) { }
{ "end_byte": 252, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocParseStarEquals.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag3.ts_0_422
// @strict: true // @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @type {{ f(s: string): void } & Record<string, unknown> }} */ let obj = /** @satisfies {{ g(s: string): void } & Record<string, unknown>} */ ({ f(s) { }, // "incorrect" implicit any on 's' g(s) { } }); // This needs ...
{ "end_byte": 422, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag3.ts" }
TypeScript/tests/cases/conformance/jsdoc/inferThis.ts_0_395
// @noEmit: true // @allowJs: true // @checkJs: true // @filename: /a.js export class C { /** * @template T * @this {T} * @return {T} */ static a() { return this; } /** * @template T * @this {T} * @return {T} */ b() { return this; } } co...
{ "end_byte": 395, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/inferThis.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocLinkTag6.ts_0_127
// @filename: /a.ts class A { foo() {} } class B extends A { /** * @override {@link A.foo} */ foo() {} }
{ "end_byte": 127, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocLinkTag6.ts" }
TypeScript/tests/cases/conformance/jsdoc/constructorTagWithThisTag.ts_0_240
// @allowJs: true // @noEmit: true // @checkJs: true // @Filename: classthisboth.js /** * @class * @this {{ e: number, m: number }} * this-tag should win, both 'e' and 'm' should be defined. */ function C() { this.e = this.m + 1 }
{ "end_byte": 240, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/constructorTagWithThisTag.ts" }
TypeScript/tests/cases/conformance/jsdoc/importTag13.ts_0_177
// @checkJs: true // @allowJs: true // @noEmit: true // @filename: /types.ts export interface Foo { a: number; } // @filename: /foo.js /** @import x = require("types") */
{ "end_byte": 177, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/importTag13.ts" }
TypeScript/tests/cases/conformance/jsdoc/typedefTagWrapping.ts_0_2499
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: mod1.js /** * @typedef {function(string): boolean} * Type1 */ /** * Tries to use a type whose name is on a different * line than the typedef tag. * @param {Type1} func The function to call. * @param {string} arg The argument to call it with. ...
{ "end_byte": 2499, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typedefTagWrapping.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocAugments_nameMismatch.ts_0_137
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /b.js class A {} class B {} /** @augments A */ class C extends B {}
{ "end_byte": 137, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocAugments_nameMismatch.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag11.ts_0_330
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} T1 * @property {number} a */ /** * @typedef {Object} T2 * @property {number} a */ /** * @satisfies {T1} * @satisfies {T2} */ const t1 = { a: 1 }; /** * @satisfies {number} */ const t2 = /** @satisfies {number...
{ "end_byte": 330, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag11.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocAugments_qualifiedName.ts_0_171
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /a.js export class A {} // @Filename: /b.js import * as a from "./a"; /** @augments a.A */ class B {}
{ "end_byte": 171, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocAugments_qualifiedName.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocAugments_noExtends.ts_0_187
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /b.js class A { constructor() { this.x = 0; } } /** @augments A */ class B { m() { return this.x; } }
{ "end_byte": 187, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocAugments_noExtends.ts" }
TypeScript/tests/cases/conformance/jsdoc/extendsTag1.ts_0_225
// @noEmit: true // @allowJs: true // @checkJs: true // @lib: esnext // @Filename: bug25101.js /** * @template T * @extends {Set<T>} Should prefer this Set<T>, not the Set in the heritage clause */ class My extends Set {}
{ "end_byte": 225, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/extendsTag1.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTemplateTag.ts_0_505
// @allowJs: true // @checkJs: true // @noEmit: true // @lib: dom,esnext // @Filename: forgot.js /** * @param {T} a * @template T */ function f(a) { return () => a } let n = f(1)() /** * @param {T} a * @template T * @returns {function(): T} */ function g(a) { return () => a } let s = g('hi')() /** * @...
{ "end_byte": 505, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTemplateTag.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocTypeDefAtStartOfFile.ts_0_245
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: dtsEquivalent.js /** @typedef {{[k: string]: any}} AnyEffect */ /** @typedef {number} Third */ // @Filename: index.js /** @type {AnyEffect} */ let b; /** @type {Third} */ let c;
{ "end_byte": 245, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocTypeDefAtStartOfFile.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocSignatureOnReturnedFunction.ts_0_743
// @allowJs: true // @checkJs: true // @target: esnext // @noImplicitAny: true // @declaration: true // @outDir: out // @Filename: jsdocSignatureOnReturnedFunction.js function f1() { /** * @param {number} a * @param {number} b * @returns {number} */ return (a, b) => { return a + b; ...
{ "end_byte": 743, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocSignatureOnReturnedFunction.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag7.ts_0_423
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {"a" | "b" | "c" | "d"} Keys */ const p = /** @satisfies {Record<Keys, unknown>} */ ({ a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' }) // Should be OK -- retain info that a is number and b is string let a...
{ "end_byte": 423, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocSatisfiesTag7.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocOptionalParamOrder.ts_3_186
@allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** * @param {number} a * @param {number} [b] * @param {number} c */ function foo(a, b, c) {}
{ "end_byte": 186, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocOptionalParamOrder.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocLinkTag2.ts_0_219
// @noUnusedLocals: true // @checkJs: true // @allowJs: true // @target: esnext // @noEmit: true // @filename: /a.js export class A {} // @filename: /b.js import { A } from "./a"; /** {@link A} */ export class B {}
{ "end_byte": 219, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocLinkTag2.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts_0_550
// @allowJS: true // @suppressOutputPathCheck: true // @strictNullChecks: true // @filename: 0.js // @ts-check var lol; const obj = { /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) ...
{ "end_byte": 550, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts" }
TypeScript/tests/cases/conformance/jsdoc/checkJsdocOnEndOfFile.ts_0_137
// @outFile: output.js // @allowJs: true // @checkJs: true // @Filename: eof.js /** * @typedef {Array<bad>} Should have error here */
{ "end_byte": 137, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/checkJsdocOnEndOfFile.ts" }
TypeScript/tests/cases/conformance/jsdoc/paramTagOnCallExpression.ts_0_257
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: decls.d.ts declare function factory(type: string): {}; // @Filename: a.js // from util /** @param {function} ctor - A big long explanation follows */ exports.inherits = factory('inherits')
{ "end_byte": 257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/paramTagOnCallExpression.ts" }
TypeScript/tests/cases/conformance/jsdoc/jsdocImportTypeReferenceToCommonjsModule.ts_0_220
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: ex.d.ts declare var config: { fix: boolean } export = config; // @Filename: test.js /** @param {import('./ex')} a */ function demo(a) { a.fix }
{ "end_byte": 220, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/jsdocImportTypeReferenceToCommonjsModule.ts" }
TypeScript/tests/cases/conformance/jsdoc/paramTagNestedWithoutTopLevelObject4.ts_0_186
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: paramTagNestedWithoutTopLevelObject4.js /** * @param {number} xyz.bar.p */ function g(xyz) { return xyz.bar.p; }
{ "end_byte": 186, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/paramTagNestedWithoutTopLevelObject4.ts" }
TypeScript/tests/cases/conformance/jsdoc/typedefOnSemicolonClassElement.ts_0_197
// @filename: typedefOnSemicolonClassElement.js // @checkJs: true // @outdir: dist // @declaration: true export class Preferences { /** @typedef {string} A */ ; /** @type {A} */ a = 'ok' }
{ "end_byte": 197, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typedefOnSemicolonClassElement.ts" }
TypeScript/tests/cases/conformance/jsdoc/paramTagBracketsAddOptionalUndefined.ts_0_418
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: a.js /** * @param {number} [p] * @param {number=} q * @param {number} [r=101] */ function f(p, q, r) { p = undefined q = undefined // note that, unlike TS, JSDOC [r=101] retains | undefined because // there's no cod...
{ "end_byte": 418, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/paramTagBracketsAddOptionalUndefined.ts" }
TypeScript/tests/cases/conformance/jsdoc/typedefCrossModule4.ts_0_151
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: mod3.js /** @typedef {number} Foo */ class Bar { } module.exports = { Foo: Bar };
{ "end_byte": 151, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/jsdoc/typedefCrossModule4.ts" }