Generated types have unstable field order
It looks like
The order of object properties in
As a result, diffs are detected in CI and the job fails.
I followed this guide for generating types in CI:
https://supabase.com/docs/guides/deployment/ci/generating-types
Example:
- Args: { first_name; last_name; email }
+ Args: { first_name; email; last_name }
Expected: the generated types should always have the same order for a given schema, regardless of environment.
Is there a recommended solution or workaround for this?
supabase gen types typescript does not produce deterministic output.The order of object properties in
Args and Returns is not stable between local and CI runs, even when the schema is the same.As a result, diffs are detected in CI and the job fails.
I followed this guide for generating types in CI:
https://supabase.com/docs/guides/deployment/ci/generating-types
Example:
- Args: { first_name; last_name; email }
+ Args: { first_name; email; last_name }
Expected: the generated types should always have the same order for a given schema, regardless of environment.
Is there a recommended solution or workaround for this?
Generate types using GitHub Actions | Supabase Docs
End-to-end type safety across client, server, and database.
2 Replies
you can try seting up an eslint rule which sorts object keys alphabetically. For example
https://eslint.org/docs/latest/rules/sort-keys
It worked! Thanks!