Skip to content

[FEATURE]: Preserve/allow for JSDoc comments in inferred types #4015

@tobi-or-not-tobi

Description

@tobi-or-not-tobi

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When using Drizzle's type inference ($inferSelect), JSDoc comments from the schema definition are lost in the inferred types. This makes it harder to maintain self-documenting code as the documentation needs to be duplicated or is lost entirely when working with the inferred types.

Current Behavior

// schema.ts
export const myTable = pgTable('my_table', {
  /** The value of the style property */
  value: text('value'),
});

// model.ts
export type MyTable = typeof myTable.$inferSelect;

// The resulting type loses all JSDoc comments:
// type MyTable = {
//   value: string | null;
// }

I'd hope we can infer the JSDoc or have an alternative way to provide generation of JSDoc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions