Skip to content

Commit 5dbbab9

Browse files
authored
Merge pull request #8504 from LuLaValva/8356-chainable-ts
fix: use `@chainable` per-overload
2 parents 612a5f9 + 8faec62 commit 5dbbab9

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

utils/data-processor.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ export function processData(rawData, strategy) {
239239
...locationInfo(entry),
240240
...deprecationInfo(entry),
241241
itemtype: 'method',
242-
chainable: (prevItem?.chainable || entry.tags?.some(tag => tag.title === 'chainable'))
243-
? 1
244-
: undefined,
245242
description: prevItem?.description || strategy.processDescription(entry.description),
246243
example: [
247244
...(prevItem?.example || []),
@@ -259,7 +256,8 @@ export function processData(rawData, strategy) {
259256
return: entry.returns?.[0] && {
260257
description: strategy.processDescription(entry.returns[0].description),
261258
...strategy.processType(entry.returns[0].type)
262-
}
259+
},
260+
chainable: entry.tags?.some(tag => tag.title === 'chainable') ? 1 : undefined
263261
}
264262
],
265263
return: prevItem?.return || entry.returns?.[0] && {

utils/typescript.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ function generateMethodDeclaration(method, options = {}) {
504504
.join(', ');
505505

506506
let returnType = 'void';
507-
if (method.chainable && !globalFunction && options.currentClass !== 'p5') {
507+
if (overload.chainable && !globalFunction && options.currentClass !== 'p5') {
508508
returnType = options.currentClass || 'this';
509509
// TODO: Decide what should be chainable. Many of these are accidental / not thought through
510510
} else if (overload.return && overload.return.type) {

0 commit comments

Comments
 (0)