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

attest: add option to normalize property/union order when serializing types #1270

Open
ssalbdivad opened this issue Jan 24, 2025 · 0 comments
Labels
external-contributor-friendly Doesn't rely heavily on contextual knowledge of ArkType (may still be complex)

Comments

@ssalbdivad
Copy link
Member

ssalbdivad commented Jan 24, 2025

This would allow alphabetizing properties/union members when serializing a type like:

declare const t: {
    b: "b" | "a"
    a: 1
}


attest(t).type.toString.normalizedSnap(`{
    a: 1
    b: "a" | "b"
}`)

Can be useful for property order that can change across versions

Have considered patching tsc (although it seems hard to access emitObjectLiteralExpression externally since it is defined in the createPrinter function). Also could potentially join displayParts, but some complexity there as well.

@github-project-automation github-project-automation bot moved this to To do in arktypeio Jan 24, 2025
@ssalbdivad ssalbdivad changed the title Option to normalize property/union order when serializing types attest: add option to normalize property/union order when serializing types Jan 24, 2025
@ssalbdivad ssalbdivad added the external-contributor-friendly Doesn't rely heavily on contextual knowledge of ArkType (may still be complex) label Jan 24, 2025
@ssalbdivad ssalbdivad moved this from To do to Backlog in arktypeio Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor-friendly Doesn't rely heavily on contextual knowledge of ArkType (may still be complex)
Projects
Status: Backlog
Development

No branches or pull requests

1 participant