TypeScript Version:
Search Terms:
- ts8020
- "jsdoc types can only be used"
- "JSDoc types can only be used inside documentation comments"
Code
function isString(str: string): str is string! {
return typeof str === 'string';
}
Expected behavior:
Error message should not mention JSDoc syntax. IMHO it should be TS1144: '{' or ';' expected., which is the case with this code for example:
function isString(str: string): str is string? {
return typeof str === 'string';
}
Actual behavior:
Error message states that this is JSDoc syntax (am not sure it even is). Full output of tsc:
> tsc test.ts
test.ts:1:40 - error TS8020: JSDoc types can only be used inside documentation comments.
1 function isString(str: string): str is string! {
~~~~~~~
Found 1 error.
Playground Link:
here
Related Issues:
TypeScript Version:
Search Terms:
Code
Expected behavior:
Error message should not mention JSDoc syntax. IMHO it should be
TS1144: '{' or ';' expected., which is the case with this code for example:Actual behavior:
Error message states that this is JSDoc syntax (am not sure it even is). Full output of
tsc:Playground Link:
here
Related Issues: