Skip to content

fix(typegen): improve ts typegen consistency between generation #964

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

Conversation

avallete
Copy link
Member

What kind of change does this PR introduce?

  • Improve typescript function args generation so it's more stable for the same function declaration
  • Add a test to avoid regression, ensuring that the type generation is stable regardless of:
  1. Entity order creation (eg: CREATE TABLE A; CREATE TABLE B or CREATE TABLE B; CREATE TABLE A) should always result in the same final types.
  2. Entities properties order declaration (except for enums). Which wasn't the case for function args declaration (eg: CREATE TABLE A (col1, col2) or CREATE TABLE A (col2, col1)) should always result in the same final types.

Fixes: #959

@avallete avallete requested review from a team as code owners July 30, 2025 13:48
Copy link
Member Author

@avallete avallete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments for reviewers.

@@ -629,659 +629,6 @@ test('typegen: typescript', async () => {
)
})

test('typegen w/ one-to-one relationships', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -2593,6 +1940,273 @@ test('typegen: typescript w/ postgrestVersion', async () => {
)
})

test('typegen: typescript consistent types definitions orders', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In there we now have something that should warn us if a regression in generation stability occurs on any of the main entities.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 16624405741

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 76.144%

Totals Coverage Status
Change from base Build 16572260530: 0.01%
Covered Lines: 5190
Relevant Lines: 6732

💛 - Coveralls

@avallete avallete requested a review from soedirgo July 30, 2025 15:09
@avallete avallete merged commit c626519 into master Jul 30, 2025
5 checks passed
@avallete avallete deleted the avallete/pgmeta-63-generated-types-not-consistently-reproducible branch July 30, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated types not consistently reproducable
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy