Typesafe references?

Why does this not show any kind of error?
export const a = pgTable('a', {
  id: uuid("id").primaryKey().defaultRandom()
});
export const b = pgTable('b', {
  id: uuid("id").primaryKey().defaultRandom(),
  aId: timestamp('a_id').references(() => a.id).notNull()
});

A timestamp referencing a UUID should not be possible... How do I get this to be typesafe, so references checks the field that is referenced to be the same type?
Was this page helpful?