Skip to content

Commit

Permalink
fix: link inside a repeatable contain a key (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrutayisire authored Dec 11, 2024
1 parent a001f06 commit eb32f54
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [7.13.1-alpha.0](https://github.com/prismicio/prismic-client/compare/v7.12.0...v7.13.1-alpha.0) (2024-12-11)


### Features

* add support for repeatable links in models ([#355](https://github.com/prismicio/prismic-client/issues/355)) ([ed120a8](https://github.com/prismicio/prismic-client/commit/ed120a8606b8de0e6c651dc859e350a732d76768)), closes [#360](https://github.com/prismicio/prismic-client/issues/360)


### Bug Fixes

* link inside a repeatable contain a key ([939cac9](https://github.com/prismicio/prismic-client/commit/939cac9eb5d485f036d5895f4adabc912f2de3ae))


### Chore

* Release alpha as patch ([a2d778f](https://github.com/prismicio/prismic-client/commit/a2d778fa201b796578dd73750f6a7058d75542a2))
* **release:** 7.13.0 ([a001f06](https://github.com/prismicio/prismic-client/commit/a001f06778c934fdceaf31c460664a14957315a2))

## [7.13.0](https://github.com/prismicio/prismic-client/compare/v7.12.0...v7.13.0) (2024-12-05)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prismicio/client",
"version": "7.13.0",
"version": "7.13.1-alpha.0",
"description": "The official JavaScript + TypeScript client library for Prismic",
"keywords": [
"typescript",
Expand Down Expand Up @@ -69,8 +69,8 @@
"prepare": "npm run build",
"release": "npm run test && standard-version && git push --follow-tags && npm run build && npm publish",
"release:dry": "standard-version --dry-run",
"release:alpha": "npm run test && standard-version --release-as minor --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
"release:alpha:dry": "standard-version --release-as minor --prerelease alpha --dry-run",
"release:alpha": "npm run test && standard-version --release-as patch --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
"release:alpha:dry": "standard-version --release-as patch --prerelease alpha --dry-run",
"lint": "eslint --ext .js,.ts .",
"types": "tsc --noEmit",
"unit": "vitest run --coverage",
Expand Down
7 changes: 6 additions & 1 deletion src/types/value/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ export type AnySlicePrimaryField = GroupField | AnyRegularField
export type Repeatable<
Field extends LinkField,
State extends FieldState = FieldState,
> = State extends "empty" ? [] : [Field, ...Field[]]
> = State extends "empty" ? [] : [WithKey<Field>, ...WithKey<Field>[]]

/**
* Wrapper to add a key to a field when inside a repeatable.
*/
type WithKey<Field extends LinkField> = Field & { key: string }

/**
* Useful to flatten the type output to improve type hints shown in editors. And
Expand Down

0 comments on commit eb32f54

Please sign in to comment.