Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-core/ui-components",
"version": "1.6.2",
"version": "1.6.3",
"type": "module",
"exports": {
"./*": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
}

.root {
@apply flex
@apply mb-3
flex
flex-col
gap-4
rounded-sm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ export const Nested: Story = {
},
],
},
{
name: 'Returns',
kind: 'return',
description: 'description',
type: (
<>
<a href="#">&lt;Promise&gt;</a>|
<a href="#">&lt;AsyncIterable&gt;</a>
</>
),
},
],
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,24 @@ const renderSignature = (param: SignatureDefinition, index: number) => (

const FunctionSignature: FC<FunctionSignatureProps> = ({ title, items }) => {
if (title) {
const attributes: Array<SignatureDefinition> = [];
Copy link
Member

@araujogui araujogui Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would:

const { attributes, returnTypes } = items.reduce(
  (acc, item) => {
    (item.kind === 'return' ? acc.returnTypes : acc.attributes).push(item);
    return acc;
  },
  { attributes: [] as SignatureDefinition[], returnTypes: [] as SignatureDefinition[] }
);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least

const attributes: SignatureDefinition[] = [];
const returnTypes: SignatureDefinition[] = [];

for (const item of items) {
  const target = item.kind === 'return' ? returnTypes : attributes;
  target.push(item);
}

const returnTypes: Array<SignatureDefinition> = [];

for (const item of items) {
(item.kind === 'return' ? returnTypes : attributes).push(item);
}

return (
<Signature title={title}>
{items.map((param, i) => renderSignature(param, i))}
</Signature>
<>
<Signature title={title}>
{attributes.map((param, i) => renderSignature(param, i))}
</Signature>

{returnTypes.length > 0 &&
returnTypes.map((param, i) =>
renderSignature(param, attributes.length + i)
)}
</>
);
}

Expand Down
Loading