version-changes.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.dev/license
  7. */
  8. import { TargetVersion } from './target-version';
  9. export type VersionChanges<T> = {
  10. [target in TargetVersion]?: ReadableChange<T>[];
  11. };
  12. export type ReadableChange<T> = {
  13. pr: string;
  14. changes: T[];
  15. };
  16. /** Conditional type that unwraps the value of a version changes type. */
  17. export type ValueOfChanges<T> = T extends VersionChanges<infer X> ? X : null;
  18. /**
  19. * Gets the changes for a given target version from the specified version changes object.
  20. *
  21. * For readability and a good overview of breaking changes, the version change data always
  22. * includes the related Pull Request link. Since this data is not needed when performing the
  23. * upgrade, this unused data can be removed and the changes data can be flattened into an
  24. * easy iterable array.
  25. */
  26. export declare function getChangesForTarget<T>(target: TargetVersion, data: VersionChanges<T>): T[];
  27. /**
  28. * Gets all changes from the specified version changes object. This is helpful in case a migration
  29. * rule does not distinguish data based on the target version, but for readability the
  30. * upgrade data is separated for each target version.
  31. */
  32. export declare function getAllChanges<T>(data: VersionChanges<T>): T[];