Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
tobi-or-not-tobi opened this issue Jan 27, 2025 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@tobi-or-not-tobi
Copy link

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.

@tobi-or-not-tobi tobi-or-not-tobi added the enhancement New feature or request label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant