contentful.js
contentful.js copied to clipboard
Typescript Asset type error
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
Hey @rewop this will be fixed in https://github.com/contentful/contentful.js/pull/206
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?