Skip to content

Commit 7134584

Browse files
committed
skip jsdoc params
1 parent c8d4721 commit 7134584

File tree

3 files changed

+31
-35
lines changed

3 files changed

+31
-35
lines changed

internal/checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30940,7 +30940,7 @@ func (c *Checker) IsUntypedSignatureInJSFile(declaration *ast.Node) bool {
3094030940
if declaration.FunctionLikeData().FullSignature != nil && declaration.FunctionLikeData().FullSignature.Type() != nil {
3094130941
return false
3094230942
}
30943-
if core.Some(declaration.Parameters(), hasType) {
30943+
if core.Some(getAllJSDocTags(declaration), ast.IsJSDocParameterTag) || core.Some(declaration.Parameters(), hasType) {
3094430944
return false
3094530945
}
3094630946
return c.getContextualSignatureForFunctionLikeDeclaration(declaration) == nil
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0.
2+
bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1.
3+
bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2.
4+
5+
6+
==== foo.js (0 errors) ====
7+
/**
8+
* @param a
9+
* @param b
10+
* @param c
11+
*/
12+
function f(a, b, c) { }
13+
14+
15+
==== bar.ts (3 errors) ====
16+
f(); // Error
17+
~
18+
!!! error TS2554: Expected 3 arguments, but got 0.
19+
!!! related TS6210 foo.js:6:12: An argument for 'a' was not provided.
20+
f(1); // Error
21+
~
22+
!!! error TS2554: Expected 3 arguments, but got 1.
23+
!!! related TS6210 foo.js:6:15: An argument for 'b' was not provided.
24+
f(1, 2); // Error
25+
~
26+
!!! error TS2554: Expected 3 arguments, but got 2.
27+
!!! related TS6210 foo.js:6:18: An argument for 'c' was not provided.
28+
29+
f(1, 2, 3); // OK
30+

testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)