Order of field in typescript types is not deterministic
kevinm416 opened this issue · comments
Kevin Morgan commented
The same java classes generate typescript types with the fields in different orders. For example, I often see a type in my project flip back and forth between:
export interface Slice<T> {
size: number;
content: T[];
number: number;
sort: Sort;
numberOfElements: number;
pageable: Pageable;
first: boolean;
last: boolean;
empty: boolean;
}
export interface Slice<T> {
size: number;
content: T[];
number: number;
sort: Sort;
first: boolean;
last: boolean;
pageable: Pageable;
numberOfElements: number;
empty: boolean;
}
It would be helpful for the fields to be listed in a deterministic order so that I can have an automated check to see if the api is changing, just by comparing the files for equality.
Kevin Morgan commented
Nevermind, after trying to fix the issue I discovered there is already an option for this in the project: https://www.habarta.cz/typescript-generator/maven/typescript-generator-maven-plugin/generate-mojo.html#sortDeclarations.