Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publishedVersion is missing from EntitySys type #2408

Open
seanparmelee opened this issue Dec 20, 2024 · 0 comments
Open

publishedVersion is missing from EntitySys type #2408

seanparmelee opened this issue Dec 20, 2024 · 0 comments

Comments

@seanparmelee
Copy link

Hello, we're using this library to fetch some entries from the delivery api via the getEntries method. For these entries, we'd like to examine their published version. I noticed the API & library are returning the sys.publishedVersion field (and is mentioned in the docs here), but it seems to be missing from the TypeScript types in this library.

Expected Behavior

Given an Entry, I'd expect to be able to access the sys.publishedVersion field, i.e.

import * as contentful from 'contentful';

const contentfulClient = contentful.createClient({
  space: 'space',
  accessToken: 'token'
});

contentfulClient
  .getEntry('entryId')
  .then((entry) => console.log(entry.sys.publishedVersion))

Actual Behavior

The code results in a TypeScript error:

Property 'publishedVersion' does not exist on type 'EntrySys & { contentType: { sys: { id: string; }; }; }'. ts(2339) 

Possible Solution

I think it's just be a matter of adding publishedVersion: number; to the EntitySys type.

Steps to Reproduce

Copy aforementioned code into a TypeScript project that has contentful installed as a dependency or see the TS error on https://codesandbox.io/p/sandbox/serene-voice-h6rdc2

Context

We're developing a new feature that involves keeping track of which version of a particular entry a user has seen (so we can let users know if/when there's a new version available than the last one they saw) and we were planning on leveraging the publishedVersion field for this.

Environment

  • Language Version: node v22.12.0
  • Package Manager Version: pnpm v9.15.0
  • Browser Version: n/a
  • Operating System: Darwin P62P7H941C 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:35:29 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_ARM64_T6000 arm64
  • Package Version: 11.3.2
  • Which API are you using?: Delivery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant