File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -504,9 +504,13 @@ function generateMethodDeclaration(method, options = {}) {
504504 . join ( ', ' ) ;
505505
506506 let returnType = 'void' ;
507- if ( method . chainable && ! globalFunction && options . currentClass !== 'p5' ) {
508- returnType = options . currentClass || 'this' ;
509- // TODO: Decide what should be chainable. Many of these are accidental / not thought through
507+ if ( method . chainable && ! globalFunction ) {
508+ // In global mode, use P5 (the imported class type) instead of p5 (the namespace)
509+ if ( options . inGlobalMode && options . currentClass === 'p5' ) {
510+ returnType = 'P5' ;
511+ } else {
512+ returnType = options . currentClass || 'this' ;
513+ }
510514 } else if ( overload . return && overload . return . type ) {
511515 returnType = convertTypeToTypeScript ( overload . return . type , options ) ;
512516 } else if ( method . return && method . return . type ) {
You can’t perform that action at this time.
0 commit comments