Skip to content

Commit 521a952

Browse files
EvanBaconclaude
andcommitted
Add proper typing for XCSwiftPackageVersionRequirement
Replace `Record<string, any>` with a discriminated union type that captures all version requirement variants: - upToNextMajorVersion - upToNextMinorVersion - versionRange - exactVersion - branch - revision Also fix repositoryURL to be optional per the Swift implementation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a5605ac commit 521a952

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

src/json/types.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,40 @@ export interface XCSwiftPackageProductDependency<TPackage = UUID>
594594
productName?: string;
595595
}
596596

597+
/** Version requirement for a remote Swift package. */
598+
export type XCSwiftPackageVersionRequirement =
599+
| {
600+
kind: "upToNextMajorVersion";
601+
minimumVersion: string;
602+
}
603+
| {
604+
kind: "upToNextMinorVersion";
605+
minimumVersion: string;
606+
}
607+
| {
608+
kind: "versionRange";
609+
minimumVersion: string;
610+
maximumVersion: string;
611+
}
612+
| {
613+
kind: "exactVersion";
614+
version: string;
615+
}
616+
| {
617+
kind: "branch";
618+
branch: string;
619+
}
620+
| {
621+
kind: "revision";
622+
revision: string;
623+
};
624+
597625
export interface XCRemoteSwiftPackageReference
598626
extends AbstractObject<ISA.XCRemoteSwiftPackageReference> {
599627
/** URL the Swift package was installed from. */
600-
repositoryURL: string;
628+
repositoryURL?: string;
601629
/** Version requirements. */
602-
requirement?: Record<string, any>;
630+
requirement?: XCSwiftPackageVersionRequirement;
603631
}
604632

605633
export interface XCLocalSwiftPackageReference

0 commit comments

Comments
 (0)