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

Top level id, contentType and type on Entry #92

Open
muhammad-saleh opened this issue Jul 2, 2021 · 1 comment
Open

Top level id, contentType and type on Entry #92

muhammad-saleh opened this issue Jul 2, 2021 · 1 comment

Comments

@muhammad-saleh
Copy link

Hi,
Thank you for the amazing work done here, Really appreciate it.

Currently if I want to know the content type of an entry I have to do it like: entry.sys.contentType.id and it's similar to other properties like id and type as well

Is there a way to get this info in a simpler way? for example:
entry.id
entry.contentType
entry.type

If not then is this something the team could consider?

Thank you!

@idosius
Copy link

idosius commented Aug 12, 2021

In fact, it seems like the wrong types are generated.

I'm using Gatsby + Contentful. When I look at the possible GQL queries via http://localhost:8000/___graphql for some allContentful* query, then there is no entry.sys.id. However, there is an entry.id.

This is not reflected at all in the generated contentful.d.ts, thus there is a mismatch between the actual type returned by a GQL query in Gatsby vs. the generated types.

Gatsby debug info:

  System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 92.0.4515.131
    Edge: 92.0.902.67
    Firefox: 89.0.2
    Safari: 14.1.1
  npmPackages:
    gatsby: ^3.10.1 => 3.10.2 
    gatsby-background-image: ^1.5.3 => 1.5.3 
    gatsby-plugin-gatsby-cloud: ^2.10.1 => 2.10.1 
    gatsby-plugin-image: ^1.10.1 => 1.10.1 
    gatsby-plugin-react-helmet: ^4.10.0 => 4.10.0 
    gatsby-plugin-sharp: ^3.10.2 => 3.10.2 
    gatsby-plugin-styled-components: ^4.10.0 => 4.10.0 
    gatsby-source-contentful: ^5.10.0 => 5.10.0 
    gatsby-transformer-remark: ^4.7.0 => 4.7.0 
    gatsby-transformer-sharp: ^3.10.0 => 3.10.0 
  npmGlobalPackages:
    gatsby-cli: 3.10.0

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

2 participants