From 2f5e2f0a3e35776b79d00345121d12bbb6c9148a Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Fri, 24 Jul 2026 14:13:39 +0200 Subject: [PATCH] Fix @internal fields on type aliases being printed to API docs --- scripts/generate-api-docs.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/generate-api-docs.ts b/scripts/generate-api-docs.ts index 68b20ba..d5f6e81 100644 --- a/scripts/generate-api-docs.ts +++ b/scripts/generate-api-docs.ts @@ -1469,13 +1469,19 @@ const generateDocs = (entryFiles: string[], apiConfigFile: string, dry = false) typeProperties.forEach((prop) => { // Create a synthetic property signature for each resolved property const propName = prop.getName(); + const propDeclaration = prop.valueDeclaration || prop.declarations?.[0]; + + // Skip members marked @internal + if (propDeclaration && ts.getJSDocTags(propDeclaration).some(tag => tag.tagName.text === 'internal')) { + return; + } + const propType = typeChecker.getTypeOfSymbolAtLocation(prop, declaration); const propTypeString = getTypeString(propType); const isOptional = (prop.flags & ts.SymbolFlags.Optional) !== 0; // Get JSDoc from the original declaration let desc = ''; - const propDeclaration = prop.valueDeclaration || prop.declarations?.[0]; if (propDeclaration) { const rawDesc = getFullJSDocDescription(propDeclaration); if (rawDesc) { @@ -1689,6 +1695,16 @@ const generateDocs = (entryFiles: string[], apiConfigFile: string, dry = false) } else { // For complex types, use the original text typeText = declaration.type.getText(); + + // Drop members marked @internal from the printed definition + if (ts.isTypeLiteralNode(declaration.type)) { + for (const member of declaration.type.members) { + if (ts.getJSDocTags(member).some(tag => tag.tagName.text === 'internal')) { + typeText = typeText.replace(member.getText(), ''); + } + } + } + // Format object types with proper line breaks if (typeText.includes('{')) { typeText = formatObjectType(typeText);