You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Allow type predicates
1. Parse type predicates. Note that they are parsed everywhere, and get
the appropriate error when used places besides a return type.
2. When creating a type predicate, correctly find the function's parameters
starting from the jsdoc return type.
* Fix type of TypePredicateNode.parent: add JSDocTypeExpression
* Update API baselines
* Handle JSDoc signature inside @type annotations
* Fix circularity when getting type predicates
Also move createTypePredicateFromTypePredicateNode closer to its use
* More cleanup based on review comments
Copy file name to clipboardExpand all lines: tests/baselines/reference/jsdocTypeTagCast.errors.txt
+4-10
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,7 @@ tests/cases/conformance/jsdoc/b.js(58,1): error TS2322: Type 'SomeFakeClass' is
11
11
Types of property 'p' are incompatible.
12
12
Type 'string | number' is not assignable to type 'number'.
13
13
Type 'string' is not assignable to type 'number'.
14
-
tests/cases/conformance/jsdoc/b.js(66,8): error TS2352: Conversion of type 'boolean' to type 'string | number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
15
-
tests/cases/conformance/jsdoc/b.js(66,15): error TS2304: Cannot find name 'numOrStr'.
!!! error TS2352: Conversion of type 'boolean' to type 'string | number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
114
-
~~~~~~~~
115
-
!!! error TS2304: Cannot find name 'numOrStr'.
116
-
~~
117
-
!!! error TS1005: '}' expected.
110
+
~~~~~~~~~~~~~~~~~~
111
+
!!! error TS1228: A type predicate is only allowed in return type position for functions and methods.
118
112
~~~~~~~~
119
113
!!! error TS2454: Variable 'numOrStr' is used before being assigned.
0 commit comments