File tree 3 files changed +19
-0
lines changed 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -884,5 +884,9 @@ function quux() {
884
884
/**
885
885
* @import { TestOne, TestTwo } from "./types"
886
886
*/
887
+
888
+ /**
889
+ * @returns {@link SomeType}
890
+ */
887
891
````
888
892
Original file line number Diff line number Diff line change @@ -291,6 +291,14 @@ export default iterateJsdoc(({
291
291
continue ;
292
292
}
293
293
294
+ // Documentation like `@returns {@link SomeType}` is technically ambiguous. Specifically it
295
+ // could either be intepreted as a type `"@link SomeType"` or a description `"{@link SomeType}"`.
296
+ // However this is a good heuristic.
297
+ if ( tag . type . trim ( ) . startsWith ( '@' ) ) {
298
+ tag . description = `{${ tag . type } } ${ tag . description } ` ;
299
+ tag . type = '' ;
300
+ }
301
+
294
302
const mightHaveTypePosition = utils . tagMightHaveTypePosition ( tag . tag , otherModeMaps ) ;
295
303
if ( mightHaveTypePosition !== true && tag . type ) {
296
304
const modeInfo = mightHaveTypePosition === false ? '' : ` in "${ mode } " mode` ;
Original file line number Diff line number Diff line change @@ -1859,6 +1859,13 @@ export default /** @type {import('../index.js').TestCases} */ ({
1859
1859
* @import { TestOne, TestTwo } from "./types"
1860
1860
*/
1861
1861
` ,
1862
+ } ,
1863
+ {
1864
+ code : `
1865
+ /**
1866
+ * @returns {@link SomeType}
1867
+ */
1868
+ ` ,
1862
1869
}
1863
1870
] ,
1864
1871
} ) ;
You can’t perform that action at this time.
0 commit comments