contentful.js icon indicating copy to clipboard operation
contentful.js copied to clipboard

Typescript Asset type error

Open rewop opened this issue 8 years ago • 2 comments

The typescript Asset is wrong. When I call the client.sync method the following object for the asset is returned:

{ 
  sys: { 
     space: { sys: [Object] },
     type: 'Asset',
     id: 'xxxx',
     revision: 0,
     createdAt: '2017-11-01T15:36:18.377Z',
     updatedAt: '2017-11-01T15:36:21.510Z' 
  },
  fields: { 
     title: { en: 'xxxxxxx' },
     file: { en: { file: { url: 'xxxxx' } } } 
  } 
}

The fields props are localized (we need to acces en), while the definition of the ts type is not: https://github.com/contentful/contentful.js/blob/master/index.d.ts#L46

rewop avatar Nov 27 '17 15:11 rewop

Hey @rewop this will be fixed in https://github.com/contentful/contentful.js/pull/206

Khaledgarbaya avatar Nov 27 '17 15:11 Khaledgarbaya

Hey @rewop, Good catch, the shape of the sync result differs indeed from the one for getEntries. Do you have a chance to open a pull request for it?

marcolink avatar Apr 03 '20 15:04 marcolink