You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the generated types I assume that type narrowing would work fine.
const embeddedEntry = (entry: IEntry) => {
switch (entry.sys.contentType.sys.id) {
case 'article':
entry.fields // Should be known as IArticleFields here
break
case 'page':
entry.fields // Should be known as IPageFields here
}
Weirdly this does not seem to work, even though IArticleEntry should be the only one to have sys.contentType.sys.id as "article".
Is it because of the generic typing?
The text was updated successfully, but these errors were encountered:
Using the generated types I assume that type narrowing would work fine.
Weirdly this does not seem to work, even though IArticleEntry should be the only one to have
sys.contentType.sys.id
as "article".Is it because of the generic typing?
The text was updated successfully, but these errors were encountered: