Handling self referencing foreign keys

I have the following code but am getting an error that says

'people' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)

How should I handle a self referencing foreign key like in my example below?

export const people = pgTable("people",{
  id: uuid("id").primaryKey(),
  name: text("name").notNull(),
  parentId: uuid("parent_id").notNull().references(() => people.id)
})
Was this page helpful?