Skip to content

adminFieldToJSDocComment

adminFieldToJSDocComment(props): string

Defined in: packages/core/src/fields/utils.ts:57

Builds a tab-indented JSDoc comment block for a field’s description.

Reads field.interfaceDescription first, falling back to field.description. Returns an empty string when neither is set. The output is ready to insert directly above a property line in a generated TypeScript interface — lines are wrapped at 80 characters via wrapLines.

Input props.

AdminField

The resolved field definition to extract the description from.

string

A tab-indented JSDoc block string ready to splice into generated TypeScript source, or an empty string if the field has no description.

const field = text({ description: "Page title shown in browser tabs." })
adminFieldToJSDocComment({ field })
// Returns a multi-line JSDoc block wrapping the description text