diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 6a2fac5cf7..54477d5a77 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -24325,6 +24325,9 @@ func (c *Checker) getConditionalFlowTypeOfType(t *Type, node *ast.Node) *Type { covariant := true for node != nil && !ast.IsStatement(node) && node.Kind != ast.KindJSDoc { parent := node.Parent + if parent == nil { + break + } // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax if ast.IsParameter(parent) { diff --git a/internal/diagnostics/diagnostics_generated.go b/internal/diagnostics/diagnostics_generated.go index 2f9700f818..da5800eb6b 100644 --- a/internal/diagnostics/diagnostics_generated.go +++ b/internal/diagnostics/diagnostics_generated.go @@ -3522,6 +3522,8 @@ var Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear var A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag = &Message{code: 8039, category: CategoryError, key: "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", text: "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"} +var A_JSDoc_overload_tag_is_not_allowed_in_this_context = &Message{code: 8110, category: CategoryError, key: "A_JSDoc_overload_tag_is_not_allowed_in_this_context_8110", text: "A JSDoc '@overload' tag is not allowed in this context."} + var Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit = &Message{code: 9005, category: CategoryError, key: "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", text: "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."} var Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit = &Message{code: 9006, category: CategoryError, key: "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", text: "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."} @@ -7792,6 +7794,8 @@ func keyToMessage(key Key) *Message { return Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export case "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039": return A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag + case "A_JSDoc_overload_tag_is_not_allowed_in_this_context_8110": + return A_JSDoc_overload_tag_is_not_allowed_in_this_context case "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005": return Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit case "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006": diff --git a/internal/diagnostics/extraDiagnosticMessages.json b/internal/diagnostics/extraDiagnosticMessages.json index 2c916ca5f8..b1f0fca91c 100644 --- a/internal/diagnostics/extraDiagnosticMessages.json +++ b/internal/diagnostics/extraDiagnosticMessages.json @@ -74,5 +74,9 @@ "Option '--incremental' is only valid with a known configuration file (like 'tsconfig.json') or when '--tsBuildInfoFile' is explicitly provided.": { "category": "Error", "code": 5074 + }, + "A JSDoc '@overload' tag is not allowed in this context.": { + "category": "Error", + "code": 8110 } } diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index c795ad3d82..57aa3eb5ee 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -3,6 +3,7 @@ package parser import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/diagnostics" ) func (p *Parser) finishReparsedNode(node *ast.Node, locationNode *ast.Node) { @@ -112,7 +113,20 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod p.reparseList = append(p.reparseList, importDeclaration) case ast.KindJSDocOverloadTag: if fun, ok := getFunctionLikeHost(parent); ok { - p.reparseList = append(p.reparseList, p.reparseJSDocSignature(tag.AsJSDocOverloadTag().TypeExpression, fun, jsDoc, tag, fun.Modifiers())) + // Only allow @overload on function declarations and class/interface method declarations. + // Disallow on object literal methods by checking if we're in the ObjectLiteralMembers parsing context. + isObjectLiteralMethod := parent.Kind == ast.KindMethodDeclaration && + p.parsingContexts&(1<} + */ + /** + * @overload + * @param {string} termCode + * @param {string} crn + * @param {string} sis + * @returns {string} + */ + /** + * @param {string} termCode + * @param {string | string[]} crnList + * @param {string} sis + * @returns {string | Record} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. + */ + getStatus(termCode, crnList, sis) {}, + }; + \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.js b/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.js new file mode 100644 index 0000000000..98b3e1ea69 --- /dev/null +++ b/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/nilPointerInConditionalFlowType.ts] //// + +//// [test.js] +const foo = { + /** + * @overload + * @param {string} termCode + * @param {string[]} crnList + * @param {string} sis + * @returns {Record} + */ + /** + * @overload + * @param {string} termCode + * @param {string} crn + * @param {string} sis + * @returns {string} + */ + /** + * @param {string} termCode + * @param {string | string[]} crnList + * @param {string} sis + * @returns {string | Record} + */ + getStatus(termCode, crnList, sis) {}, +}; + + +//// [test.js] +const foo = { + /** + * @overload + * @param {string} termCode + * @param {string[]} crnList + * @param {string} sis + * @returns {Record} + */ + /** + * @overload + * @param {string} termCode + * @param {string} crn + * @param {string} sis + * @returns {string} + */ + /** + * @param {string} termCode + * @param {string | string[]} crnList + * @param {string} sis + * @returns {string | Record} + */ + getStatus(termCode, crnList, sis) { }, +}; diff --git a/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.symbols b/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.symbols new file mode 100644 index 0000000000..2ba96007cb --- /dev/null +++ b/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.symbols @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/nilPointerInConditionalFlowType.ts] //// + +=== test.js === +const foo = { +>foo : Symbol(foo, Decl(test.js, 0, 5)) + + /** + * @overload + * @param {string} termCode + * @param {string[]} crnList + * @param {string} sis + * @returns {Record} + */ + /** + * @overload + * @param {string} termCode + * @param {string} crn + * @param {string} sis + * @returns {string} + */ + /** + * @param {string} termCode + * @param {string | string[]} crnList + * @param {string} sis + * @returns {string | Record} + */ + getStatus(termCode, crnList, sis) {}, +>getStatus : Symbol(getStatus, Decl(test.js, 0, 13)) +>termCode : Symbol(termCode, Decl(test.js, 21, 11)) +>crnList : Symbol(crnList, Decl(test.js, 21, 20)) +>sis : Symbol(sis, Decl(test.js, 21, 29)) + +}; + diff --git a/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.types b/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.types new file mode 100644 index 0000000000..2a5ea8ff75 --- /dev/null +++ b/testdata/baselines/reference/compiler/nilPointerInConditionalFlowType.types @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/nilPointerInConditionalFlowType.ts] //// + +=== test.js === +const foo = { +>foo : { getStatus(termCode: string, crnList: string | string[], sis: string): string | Record; } +>{ /** * @overload * @param {string} termCode * @param {string[]} crnList * @param {string} sis * @returns {Record} */ /** * @overload * @param {string} termCode * @param {string} crn * @param {string} sis * @returns {string} */ /** * @param {string} termCode * @param {string | string[]} crnList * @param {string} sis * @returns {string | Record} */ getStatus(termCode, crnList, sis) {},} : { getStatus(termCode: string, crnList: string | string[], sis: string): string | Record; } + + /** + * @overload + * @param {string} termCode + * @param {string[]} crnList + * @param {string} sis + * @returns {Record} + */ + /** + * @overload + * @param {string} termCode + * @param {string} crn + * @param {string} sis + * @returns {string} + */ + /** + * @param {string} termCode + * @param {string | string[]} crnList + * @param {string} sis + * @returns {string | Record} + */ + getStatus(termCode, crnList, sis) {}, +>getStatus : (termCode: string, crnList: string | string[], sis: string) => string | Record +>termCode : string +>crnList : string | string[] +>sis : string + +}; + diff --git a/testdata/baselines/reference/conformance/jsdocVariadicInOverload.js b/testdata/baselines/reference/conformance/jsdocVariadicInOverload.js index 590e070ce7..f38bc12a54 100644 --- a/testdata/baselines/reference/conformance/jsdocVariadicInOverload.js +++ b/testdata/baselines/reference/conformance/jsdocVariadicInOverload.js @@ -131,27 +131,6 @@ export declare class Processor} * Current processor. */ - use(preset?: string | null | undefined): Processor; - /** - * @overload - * @param {string | null | undefined} [preset] - * @returns {Processor} - * - * @template {Array} [Parameters=[]] - * @template {Node | string | undefined} [Input=undefined] - * @template [Output=Input] - * @overload - * @param {number} plugin - * @param {...(Parameters | [boolean])} parameters - * @returns {Processor} - * - * @param {string | number | boolean | null | undefined} value - * Usable value. - * @param {...unknown} parameters - * Parameters, when a plugin is given as a usable value. - * @returns {Processor} - * Current processor. - */ - use = [], Input extends Node | string | undefined = undefined, Output = Input>(plugin: number, ...parameters: (Parameters | [boolean])): Processor; + use(value: string | number | boolean | null | undefined, ...parameters: unknown[]): Processor; } export {}; diff --git a/testdata/baselines/reference/conformance/jsdocVariadicInOverload.symbols b/testdata/baselines/reference/conformance/jsdocVariadicInOverload.symbols index 6451fe0acb..ba88191eb6 100644 --- a/testdata/baselines/reference/conformance/jsdocVariadicInOverload.symbols +++ b/testdata/baselines/reference/conformance/jsdocVariadicInOverload.symbols @@ -41,7 +41,7 @@ export class Processor { * Current processor. */ use(value, ...parameters) { ->use : Symbol(Processor.use, Decl(typeTagForMultipleVariableDeclarations.js, 16, 6), Decl(typeTagForMultipleVariableDeclarations.js, 23, 6), Decl(typeTagForMultipleVariableDeclarations.js, 14, 24)) +>use : Symbol(Processor.use, Decl(typeTagForMultipleVariableDeclarations.js, 14, 24)) >value : Symbol(value, Decl(typeTagForMultipleVariableDeclarations.js, 35, 6)) >parameters : Symbol(parameters, Decl(typeTagForMultipleVariableDeclarations.js, 35, 12)) @@ -59,9 +59,9 @@ var x = 1, y = 2, z = 3; >z : Symbol(z, Decl(typeTagForMultipleVariableDeclarations.js, 40, 17)) p.use(x, y, z); ->p.use : Symbol(Processor.use, Decl(typeTagForMultipleVariableDeclarations.js, 16, 6), Decl(typeTagForMultipleVariableDeclarations.js, 23, 6), Decl(typeTagForMultipleVariableDeclarations.js, 14, 24)) +>p.use : Symbol(Processor.use, Decl(typeTagForMultipleVariableDeclarations.js, 14, 24)) >p : Symbol(p, Decl(typeTagForMultipleVariableDeclarations.js, 39, 3)) ->use : Symbol(Processor.use, Decl(typeTagForMultipleVariableDeclarations.js, 16, 6), Decl(typeTagForMultipleVariableDeclarations.js, 23, 6), Decl(typeTagForMultipleVariableDeclarations.js, 14, 24)) +>use : Symbol(Processor.use, Decl(typeTagForMultipleVariableDeclarations.js, 14, 24)) >x : Symbol(x, Decl(typeTagForMultipleVariableDeclarations.js, 40, 3)) >y : Symbol(y, Decl(typeTagForMultipleVariableDeclarations.js, 40, 10)) >z : Symbol(z, Decl(typeTagForMultipleVariableDeclarations.js, 40, 17)) diff --git a/testdata/baselines/reference/conformance/jsdocVariadicInOverload.types b/testdata/baselines/reference/conformance/jsdocVariadicInOverload.types index 4a6d237327..2e1662d18e 100644 --- a/testdata/baselines/reference/conformance/jsdocVariadicInOverload.types +++ b/testdata/baselines/reference/conformance/jsdocVariadicInOverload.types @@ -41,7 +41,7 @@ export class Processor { * Current processor. */ use(value, ...parameters) { ->use : { (preset?: string): Processor; (plugin: number, ...parameters: Parameters | [boolean]): Processor; } +>use : (value: string | number | boolean, ...parameters: unknown[]) => Processor >value : string | number | boolean >parameters : unknown[] @@ -64,9 +64,9 @@ var x = 1, y = 2, z = 3; p.use(x, y, z); >p.use(x, y, z) : Processor ->p.use : { (preset?: string): Processor; (plugin: number, ...parameters: Parameters | [boolean]): Processor; } +>p.use : (value: string | number | boolean, ...parameters: unknown[]) => Processor >p : Processor ->use : { (preset?: string): Processor; (plugin: number, ...parameters: Parameters | [boolean]): Processor; } +>use : (value: string | number | boolean, ...parameters: unknown[]) => Processor >x : number >y : number >z : number diff --git a/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js b/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js index ebe7145997..a33418fdbf 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js +++ b/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js @@ -106,7 +106,6 @@ const example3 = { //// [jsFileAlternativeUseOfOverloadTag.d.ts] -declare function Example1(value: any): any; declare const example1: { /** * @overload Example1(value) @@ -115,8 +114,6 @@ declare const example1: { */ constructor: (value: any, options: any) => void; }; -declare function Example2(value: any, secretAccessKey: any, sessionToken: any): any; -declare function Example2(): any; declare const example2: { /** * Example 2 @@ -138,7 +135,6 @@ declare const example2: { */ constructor: () => void; }; -declare function evaluate(): any; type callback = (error: any, result: any) => any; declare const example3: { /** diff --git a/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js.diff b/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js.diff index f2d21bc5a2..a7fb84a241 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileAlternativeUseOfOverloadTag.js.diff @@ -5,7 +5,6 @@ //// [jsFileAlternativeUseOfOverloadTag.d.ts] -declare namespace example1 { -+declare function Example1(value: any): any; +declare const example1: { /** * @overload Example1(value) @@ -58,8 +57,6 @@ -declare namespace example3 { + constructor: (value: any, options: any) => void; +}; -+declare function Example2(value: any, secretAccessKey: any, sessionToken: any): any; -+declare function Example2(): any; +declare const example2: { + /** + * Example 2 @@ -81,13 +78,12 @@ + */ + constructor: () => void; +}; -+declare function evaluate(): any; +type callback = (error: any, result: any) => any; +declare const example3: { /** * @overload evaluate(options = {}, [callback]) * Evaluate something -@@= skipped -63, +48 lines =@@ +@@= skipped -63, +44 lines =@@ * @param result [String] * @see callback */ diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt index c45c97b5eb..eb5e2e1931 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt @@ -1,9 +1,10 @@ -overloadTag2.js(14,9): error TS2394: This overload signature is not compatible with its implementation signature. overloadTag2.js(25,20): error TS7006: Parameter 'b' implicitly has an 'any' type. -overloadTag2.js(30,9): error TS2554: Expected 1-2 arguments, but got 0. +overloadTag2.js(30,9): error TS2554: Expected 2 arguments, but got 0. +overloadTag2.js(31,9): error TS2554: Expected 2 arguments, but got 1. +overloadTag2.js(32,9): error TS2554: Expected 2 arguments, but got 1. -==== overloadTag2.js (3 errors) ==== +==== overloadTag2.js (4 errors) ==== export class Foo { #a = true ? 1 : "1" #b @@ -18,9 +19,6 @@ overloadTag2.js(30,9): error TS2554: Expected 1-2 arguments, but got 0. /** * @constructor * @overload - ~~~~~~~~ -!!! error TS2394: This overload signature is not compatible with its implementation signature. -!!! related TS2750 overloadTag2.js:25:5: The implementation signature is declared here. * @param {number} a */ /** @@ -40,9 +38,15 @@ overloadTag2.js(30,9): error TS2554: Expected 1-2 arguments, but got 0. } var a = new Foo() ~~~~~~~~~ -!!! error TS2554: Expected 1-2 arguments, but got 0. -!!! related TS6210 overloadTag2.js:15:8: An argument for 'a' was not provided. +!!! error TS2554: Expected 2 arguments, but got 0. +!!! related TS6210 overloadTag2.js:25:17: An argument for 'a' was not provided. var b = new Foo('str') + ~~~~~~~~~~~~~~ +!!! error TS2554: Expected 2 arguments, but got 1. +!!! related TS6210 overloadTag2.js:25:20: An argument for 'b' was not provided. var c = new Foo(2) + ~~~~~~~~~~ +!!! error TS2554: Expected 2 arguments, but got 1. +!!! related TS6210 overloadTag2.js:25:20: An argument for 'b' was not provided. var d = new Foo('str', 2) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff new file mode 100644 index 0000000000..a3507ee872 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff @@ -0,0 +1,46 @@ +--- old.overloadTag2.errors.txt ++++ new.overloadTag2.errors.txt +@@= skipped -0, +0 lines =@@ +-overloadTag2.js(14,9): error TS2394: This overload signature is not compatible with its implementation signature. + overloadTag2.js(25,20): error TS7006: Parameter 'b' implicitly has an 'any' type. +-overloadTag2.js(30,9): error TS2554: Expected 1-2 arguments, but got 0. +- +- +-==== overloadTag2.js (3 errors) ==== ++overloadTag2.js(30,9): error TS2554: Expected 2 arguments, but got 0. ++overloadTag2.js(31,9): error TS2554: Expected 2 arguments, but got 1. ++overloadTag2.js(32,9): error TS2554: Expected 2 arguments, but got 1. ++ ++ ++==== overloadTag2.js (4 errors) ==== + export class Foo { + #a = true ? 1 : "1" + #b +@@= skipped -17, +18 lines =@@ + /** + * @constructor + * @overload +- ~~~~~~~~ +-!!! error TS2394: This overload signature is not compatible with its implementation signature. +-!!! related TS2750 overloadTag2.js:25:5: The implementation signature is declared here. + * @param {number} a + */ + /** +@@= skipped -22, +19 lines =@@ + } + var a = new Foo() + ~~~~~~~~~ +-!!! error TS2554: Expected 1-2 arguments, but got 0. +-!!! related TS6210 overloadTag2.js:15:8: An argument for 'a' was not provided. ++!!! error TS2554: Expected 2 arguments, but got 0. ++!!! related TS6210 overloadTag2.js:25:17: An argument for 'a' was not provided. + var b = new Foo('str') ++ ~~~~~~~~~~~~~~ ++!!! error TS2554: Expected 2 arguments, but got 1. ++!!! related TS6210 overloadTag2.js:25:20: An argument for 'b' was not provided. + var c = new Foo(2) ++ ~~~~~~~~~~ ++!!! error TS2554: Expected 2 arguments, but got 1. ++!!! related TS6210 overloadTag2.js:25:20: An argument for 'b' was not provided. + var d = new Foo('str', 2) + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.js b/testdata/baselines/reference/submodule/conformance/overloadTag2.js index 8e03c4882c..79aec3b329 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag2.js +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.js @@ -74,7 +74,25 @@ var d = new Foo('str', 2); //// [overloadTag2.d.ts] export declare class Foo { #private; - constructor(a: string, b: number); - constructor(a: number); - constructor(a: string); + /** + * Should not have an implicit any error, because constructor's return type is always implicit + * @constructor + * @overload + * @param {string} a + * @param {number} b + */ + /** + * @constructor + * @overload + * @param {number} a + */ + /** + * @constructor + * @overload + * @param {string} a + */ /** + * @constructor + * @param {number | string} a + */ + constructor(a: number | string, b: any); } diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.js.diff b/testdata/baselines/reference/submodule/conformance/overloadTag2.js.diff index cdc90d2751..3e7fb1e487 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.js.diff @@ -5,27 +5,32 @@ //// [overloadTag2.d.ts] -export class Foo { -- /** -- * Should not have an implicit any error, because constructor's return type is always implicit -- * @constructor -- * @overload -- * @param {string} a -- * @param {number} b -- */ +export declare class Foo { + #private; - constructor(a: string, b: number); -- /** -- * @constructor -- * @overload -- * @param {number} a -- */ - constructor(a: number); -- /** -- * @constructor -- * @overload -- * @param {string} a + /** + * Should not have an implicit any error, because constructor's return type is always implicit + * @constructor +@@= skipped -8, +9 lines =@@ + * @param {string} a + * @param {number} b + */ +- constructor(a: string, b: number); + /** + * @constructor + * @overload + * @param {number} a + */ +- constructor(a: number); + /** + * @constructor + * @overload + * @param {string} a - */ - constructor(a: string); +- constructor(a: string); - #private; ++ */ /** ++ * @constructor ++ * @param {number | string} a ++ */ ++ constructor(a: number | string, b: any); } \ No newline at end of file diff --git a/testdata/tests/cases/compiler/nilPointerInConditionalFlowType.ts b/testdata/tests/cases/compiler/nilPointerInConditionalFlowType.ts new file mode 100644 index 0000000000..b78007ac41 --- /dev/null +++ b/testdata/tests/cases/compiler/nilPointerInConditionalFlowType.ts @@ -0,0 +1,28 @@ +// @allowJs: true +// @checkJs: true +// @outDir: ./out +// @filename: test.js + +const foo = { + /** + * @overload + * @param {string} termCode + * @param {string[]} crnList + * @param {string} sis + * @returns {Record} + */ + /** + * @overload + * @param {string} termCode + * @param {string} crn + * @param {string} sis + * @returns {string} + */ + /** + * @param {string} termCode + * @param {string | string[]} crnList + * @param {string} sis + * @returns {string | Record} + */ + getStatus(termCode, crnList, sis) {}, +};