(migration: Migration<UpgradeData>, dataName: T)
| 72 | * data portion that is specifically tied to the target version. |
| 73 | */ |
| 74 | export function getVersionUpgradeData< |
| 75 | T extends keyof UpgradeData, |
| 76 | U = ValueOfChanges<UpgradeData[T]>, |
| 77 | >(migration: Migration<UpgradeData>, dataName: T): U[] { |
| 78 | if (migration.targetVersion === null) { |
| 79 | return []; |
| 80 | } |
| 81 | |
| 82 | // Note that below we need to cast to `unknown` first TS doesn't infer the type of T correctly. |
| 83 | return getChangesForTarget<U>( |
| 84 | migration.targetVersion, |
| 85 | migration.upgradeData[dataName] as unknown as VersionChanges<U>, |
| 86 | ); |
| 87 | } |
no test coverage detected