Repository navigation
Description
What to build
Surface database column comments in the generated output as /** … */ JSDoc leading comments on the generated declarations, so they show up as editor type hints.
The introspection half is already done: the shared column-metadata already carries a comment field, populated today for MySQL and MariaDB (information_schema.COLUMNS.COLUMN_COMMENT), Postgres (pg_description), and MSSQL (sys.extended_properties / MS_Description). The comment is currently only forwarded to Sequelize's runtime comment option, not rendered as a code-level doc comment. No introspection query changes are required.
The work is purely in the emitter: attach a synthetic leading JSDoc comment (ts.addSyntheticLeadingComment with MultiLineCommentTrivia, text lead * to produce /** … */) to the generated declarations, in both output formats:
- Native format: on the
declareattribute property declarations (the primary v13 format). - Decorator format: on the class property (above its
@Columndecorator) and the strict Attributes interface property signature — the block PR Add comment generation to TypeScript interfaces #61 originally patched.
Acceptance criteria
- Columns with a non-empty comment render a
/** <comment> */JSDoc leading comment on the generated declaration in the native format (declareattributes) and the decorator format (class property and Attributes interface). - Empty/whitespace comments produce no comment (MySQL/MariaDB return
''rather than null — guard on truthiness). - SQLite is a no-op (PRAGMA exposes no column comments) and is unaffected.
- Comment text is sanitised so an embedded
*/cannot prematurely close the JSDoc block. - Integration tests: for MySQL, MariaDB, Postgres, and MSSQL a column carrying a comment produces the JSDoc in generated output; SQLite output is unchanged. Reuse PR Add comment generation to TypeScript interfaces #61's per-dialect comment-seeding SQL (MySQL/MariaDB
COMMENT '…', PostgresCOMMENT ON COLUMN …, MSSQLsp_addextendedproperty … 'MS_Description'). - On completion (once this change is merged), close PR Add comment generation to TypeScript interfaces #61 with a comment pointing to this ticket.
Blocked by
None (can start immediately).
Source
Extracted from PR #61 (predates the v13 native emitter; only patched the decorator Attributes interface). Reuse its addSyntheticLeadingComment approach and test seed SQL; redo placement to also cover the native emitter. Supersedes PR #61 — close it pointing here.
Activity
Merge pull request #92 from spinlud/array-json-jsdoc
spinlud commentedon Sep 11, 2026
Shipped in v13.1.0 (
sequelize-typescript-generator@13.1.0on npm), merged via #92. Database column comments are now emitted as/** … */JSDoc in both the native and decorator output formats. Closing.