Skip to content

Commit 7a990bc

Browse files
committed
chore: strip inline // comments from prop type documentation
INSTUI-5129
1 parent 86ef310 commit 7a990bc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/__docs__/buildScripts/utils/getReactDoc.mts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,14 @@ export function getReactDoc(
6060
error(err)
6161
}
6262
}
63+
// Strip `//` line comments from each prop's raw type
64+
if (doc?.props) {
65+
for (const prop of Object.values(doc.props)) {
66+
const tsType = prop.tsType
67+
if (tsType && 'raw' in tsType && typeof tsType.raw === 'string') {
68+
tsType.raw = tsType.raw.replace(/(?<!:)\/\/[^\n]*/g, '')
69+
}
70+
}
71+
}
6372
return doc
6473
}

0 commit comments

Comments
 (0)