File tree Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ title: Changelog
4
4
5
5
## Unreleased
6
6
7
+ ### Bug Fixes
8
+
9
+ - Cascaded modifier tags will no longer be copied into type literals, #2802 .
10
+
7
11
## v0.27.3 (2024-12-04)
8
12
9
13
### Features
Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ export class CommentPlugin extends ConverterComponent {
453
453
454
454
// Any cascaded tags will show up twice, once on this and once on our signatures
455
455
// This is completely redundant, so remove them from the wrapping function.
456
- if ( sigs . length ) {
456
+ if ( sigs . length && reflection . type ?. type !== "reflection" ) {
457
457
for ( const mod of this . cascadedModifierTags ) {
458
458
reflection . comment . modifierTags . delete ( mod ) ;
459
459
}
@@ -527,7 +527,9 @@ export class CommentPlugin extends ConverterComponent {
527
527
528
528
private cascadeModifiers ( reflection : Reflection ) {
529
529
const parentComment = reflection . parent ?. comment ;
530
- if ( ! parentComment ) return ;
530
+ if ( ! parentComment || reflection . kindOf ( ReflectionKind . TypeLiteral ) ) {
531
+ return ;
532
+ }
531
533
532
534
const childMods = reflection . comment ?. modifierTags ?? new Set ( ) ;
533
535
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Docs
3
+ * @alpha
4
+ */
5
+ export type AlphaOk = number | string ;
6
+
7
+ /**
8
+ * Docs2
9
+ * @alpha
10
+ */
11
+ export type AlphaNoGo = ( arg : number | string ) => void ;
Original file line number Diff line number Diff line change @@ -1942,4 +1942,19 @@ describe("Issue Tests", () => {
1942
1942
const type = query ( project , "typeType" ) ;
1943
1943
equal ( type . type ?. toString ( ) , "any" ) ;
1944
1944
} ) ;
1945
+
1946
+ it ( "#2802 preserves @alpha tags on signature types" , ( ) => {
1947
+ const project = convert ( ) ;
1948
+ const alpha1 = query ( project , "AlphaOk" ) ;
1949
+ equal ( Comment . combineDisplayParts ( alpha1 . comment ?. summary ) , "Docs" ) ;
1950
+ ok ( alpha1 . comment ?. hasModifier ( "@alpha" ) ) ;
1951
+
1952
+ const alpha2 = query ( project , "AlphaNoGo" ) ;
1953
+ equal ( Comment . combineDisplayParts ( alpha2 . comment ?. summary ) , "Docs2" ) ;
1954
+ ok ( alpha2 . comment ?. hasModifier ( "@alpha" ) ) ;
1955
+
1956
+ // Modifiers should not have been cascaded
1957
+ equal ( alpha2 . type ?. type , "reflection" ) ;
1958
+ equal ( alpha2 . type . declaration . comment , undefined ) ;
1959
+ } ) ;
1945
1960
} ) ;
You can’t perform that action at this time.
0 commit comments