typedoc
typedoc copied to clipboard
Sorting of union types is non-deterministic
This issue is related to https://github.com/TypeStrong/typedoc/issues/2502 but applies to non-literal types. Sorting of union types is non-deterministic.
Steps to reproduce the bug
export type Type1 = 'type1';
export type Type2 = { prop1: string; prop2: boolean };
/**
* Some Interface
*/
export interface SomeInterface {
someUnionType: Type1 | Type2;
}
Expected
Actual
Most of the times it shows
But sometimes it shows
(This is causing our CI pipeline to fail as we have a job to ensure the API Doc changes are included in pull requests)
Environment
- Typedoc version: v0.26.10
I can't reproduce this. TypeDoc is using the the type as it is reported from TypeScript, which in the ~30 times I've run it, always puts "type1" second in the union.
You can work around this by forcing Type1 to introduce a new type:
export type Type1 = 'type1' & {};