Closed brandongregoryscott closed 2 years ago
Splitting this issue off from https://github.com/brandongregoryscott/collation/issues/24#issuecomment-1085268873
Update alphabetize-interfaces to sort interfaces that have TypeIntersections. A test will already be added in this shape:
alphabetize-interfaces
TypeIntersections
it("should sort nested types with type unions", async () => { // Arrange const input = createSourceFile( ` export interface RouteMap extends GenericRouteMap { root: RouteDefinition & { routes: { library: RouteDefinition & { routes: { files: RouteDefinition; instruments: RouteDefinition; }; }; help: RouteDefinition & { routes: { usage: RouteDefinition; }; }; login: RouteDefinition; logout: RouteDefinition; register: RouteDefinition; workstation: RouteDefinition & { routes: { workstation: RouteDefinition; }; }; }; }; } ` ); const expected = createSourceFile( ` export interface RouteMap extends GenericRouteMap { root: RouteDefinition & { routes: { library: RouteDefinition & { routes: { files: RouteDefinition; instruments: RouteDefinition; }; }; help: RouteDefinition & { routes: { usage: RouteDefinition; }; }; login: RouteDefinition; logout: RouteDefinition; register: RouteDefinition; workstation: RouteDefinition & { routes: { workstation: RouteDefinition; }; }; }; }; } ` ); // Act const result = await alphabetizeInterfaces(input); // Assert expect(result).toHaveErrors(); expect(result).toMatchSourceFile(expected); await result.file.save(); });
Splitting this issue off from https://github.com/brandongregoryscott/collation/issues/24#issuecomment-1085268873
Update
alphabetize-interfaces
to sort interfaces that haveTypeIntersections
. A test will already be added in this shape: