File tree Expand file tree Collapse file tree 7 files changed +44
-10
lines changed
Expand file tree Collapse file tree 7 files changed +44
-10
lines changed Original file line number Diff line number Diff line change 1111 " --config" ,
1212 " ${workspaceFolder}/.config/mocha.fast.json" ,
1313 " -g" ,
14- " 1734 "
14+ " 2135 "
1515 ],
1616 "internalConsoleOptions" : " openOnSessionStart" ,
1717 "name" : " Debug Tests" ,
1818 "program" : " ${workspaceFolder}/node_modules/mocha/bin/_mocha" ,
1919 "request" : " launch" ,
2020 "skipFiles" : [" <node_internals>/**" ],
21- "type" : " pwa- node"
21+ "type" : " node"
2222 },
2323 {
2424 "name" : " Attach" ,
2525 "port" : 9229 ,
2626 "request" : " attach" ,
2727 "skipFiles" : [" <node_internals>/**" ],
28- "type" : " pwa- node" ,
28+ "type" : " node" ,
2929 "sourceMaps" : true
3030 }
3131 ]
Original file line number Diff line number Diff line change 11# Unreleased
22
3+ ### Bug Fixes
4+
5+ - Fixed an issue where signature comments were preferred over property comments for indirectly created function-properties, #2135 .
6+
37## v0.23.23 (2022-12-18)
48
59### Features
Original file line number Diff line number Diff line change @@ -43,13 +43,24 @@ export function createSignature(
4343 context . scope
4444 ) ;
4545
46- // If we are creating signatures for a variable and the variable has a comment associated with it
47- // then we should prefer that variable's comment over any comment on the signature. The comment plugin
46+ // If we are creating signatures for a variable or property and it has a comment associated with it
47+ // then we should prefer that comment over any comment on the signature. The comment plugin
4848 // will copy the comment down if this signature doesn't have one, so don't set one.
49+ let parentReflection = context . scope ;
50+ if (
51+ parentReflection . kindOf ( ReflectionKind . TypeLiteral ) &&
52+ parentReflection . parent instanceof DeclarationReflection
53+ ) {
54+ parentReflection = parentReflection . parent ;
55+ }
56+
4957 if (
5058 declaration &&
51- ( ! context . scope . comment ||
52- ! ( context . scope . conversionFlags & ConversionFlags . VariableSource ) )
59+ ( ! parentReflection . comment ||
60+ ! (
61+ parentReflection . conversionFlags &
62+ ConversionFlags . VariableOrPropertySource
63+ ) )
5364 ) {
5465 sigRef . comment = getSignatureComment (
5566 declaration ,
Original file line number Diff line number Diff line change @@ -623,6 +623,7 @@ function convertProperty(
623623 symbol ,
624624 exportSymbol
625625 ) ;
626+ reflection . conversionFlags |= ConversionFlags . VariableOrPropertySource ;
626627
627628 const declaration = symbol . getDeclarations ( ) ?. [ 0 ] ;
628629 let parameterType : ts . TypeNode | undefined ;
@@ -642,7 +643,7 @@ function convertProperty(
642643 reflection . defaultValue = declaration && convertDefaultValue ( declaration ) ;
643644
644645 reflection . type = context . converter . convertType (
645- context ,
646+ context . withScope ( reflection ) ,
646647 ( context . isConvertingTypeNode ( ) ? parameterType : void 0 ) ??
647648 context . checker . getTypeOfSymbol ( symbol )
648649 ) ;
@@ -894,7 +895,7 @@ function convertVariableAsFunction(
894895 exportSymbol
895896 ) ;
896897 setModifiers ( symbol , accessDeclaration , reflection ) ;
897- reflection . conversionFlags |= ConversionFlags . VariableSource ;
898+ reflection . conversionFlags |= ConversionFlags . VariableOrPropertySource ;
898899 context . finalizeDeclarationReflection ( reflection ) ;
899900
900901 const reflectionContext = context . withScope ( reflection ) ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export interface DeclarationHierarchy {
3434 */
3535export enum ConversionFlags {
3636 None = 0 ,
37- VariableSource = 1 ,
37+ VariableOrPropertySource = 1 ,
3838}
3939
4040/**
Original file line number Diff line number Diff line change 1+ export class Camera {
2+ /** One */
3+ static useCameraPermissions = createPermissionHook ( ) ;
4+ }
5+
6+ /** Two */
7+ declare function createPermissionHook ( ) : ( ) => void ;
Original file line number Diff line number Diff line change @@ -825,4 +825,15 @@ export const issueTests: {
825825 "Foo type comment"
826826 ) ;
827827 } ,
828+
829+ gh2135 ( project ) {
830+ const hook = query ( project , "Camera.useCameraPermissions" ) ;
831+ equal ( hook . type ?. type , "reflection" as const ) ;
832+ equal (
833+ Comment . combineDisplayParts (
834+ hook . type . declaration . signatures ! [ 0 ] . comment ?. summary
835+ ) ,
836+ "One"
837+ ) ;
838+ } ,
828839} ;
You can’t perform that action at this time.
0 commit comments