Skip to content

Commit

Permalink
Merge branch 'master' of github.com:prismicio/prismic-client into aa/…
Browse files Browse the repository at this point in the history
…link-variant

# Conflicts:
#	src/lib/getOptionalLinkProperties.ts
#	src/types/migration/Asset.ts
#	src/types/value/link.ts
  • Loading branch information
dani-mp committed Dec 23, 2024
2 parents d5cdf37 + f4bf4e6 commit bbfef31
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/lib/getOptionalLinkProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const getOptionalLinkProperties = (
): OptionalLinkProperties => {
const res: OptionalLinkProperties = {}

if ("variant" in input) {
res.variant = input.variant
}

if ("text" in input) {
res.text = input.text
}

if ("variant" in input) {
res.variant = input.variant
}

return res
}
6 changes: 5 additions & 1 deletion src/lib/isMigrationValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const image = (value: UnknownValue): value is MigrationImage => {
/**
* Checks if a value is a migration link to media field.
*
* - @remarks `OptionalLinkProperties` is included because
* `MigrationContentRelationship` may be a link field, not strictly a content
* relationship field.
*
* @param value - Value to check.
*
* @returns `true` if `value` is a migration link to media field, `false`
Expand All @@ -95,7 +99,7 @@ export const image = (value: UnknownValue): value is MigrationImage => {
*/
export const linkToMedia = (
value: UnknownValue,
): value is MigrationLinkToMedia => {
): value is MigrationLinkToMedia & OptionalLinkProperties => {
return (
typeof value === "object" &&
value !== null &&
Expand Down
2 changes: 1 addition & 1 deletion src/types/migration/Asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export type MigrationImage =
*/
export type MigrationLinkToMedia = Pick<
LinkToMediaField<"filled">,
"link_type"
"link_type" | "text"
> & {
/**
* A reference to the migration asset used to resolve the link to media
Expand Down
2 changes: 1 addition & 1 deletion src/types/value/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ export type FilledLinkToWebField = {
// Remember to update the `getOptionalLinkProperties()` function when updating
// this type. The function should check for every property.
export type OptionalLinkProperties = {
variant?: string
text?: string
variant?: string
}

0 comments on commit bbfef31

Please sign in to comment.