We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there,
it seems the https://github.com/contentful/field-editors/blob/master/packages/_shared/src/utils/entityHelpers.ts getFieldValue return the wrong type string | undefined. When the Field is not a string field it would return another type.
getFieldValue
string | undefined
As we would like to use the method in our App, would it be possible to
unknown | undefined
or
export function getFieldValue<T = string>({ /** * Expects an entity fetched with a flag Skip-Transformation: true */ entity, fieldId, localeCode, defaultLocaleCode, }: { entity: { fields: { [key: string]: { [valueKey: string]: string | undefined } }; }; fieldId: string; localeCode: string; defaultLocaleCode: string; }): T | undefined { const values = get(entity, ['fields', fieldId]); if (!isObject(values)) { return; } const firstLocaleCode = Object.keys(values)[0]; return values[localeCode] || values[defaultLocaleCode] || values[firstLocaleCode]; }
Thanks
Alex
The text was updated successfully, but these errors were encountered:
Marking issue as stale since there was no acitivty for 30 days
Sorry, something went wrong.
No branches or pull requests
Hi there,
it seems the https://github.com/contentful/field-editors/blob/master/packages/_shared/src/utils/entityHelpers.ts
getFieldValue
return the wrong typestring | undefined
. When the Field is not a string field it would return another type.As we would like to use the method in our App, would it be possible to
unknown | undefined
or
Thanks
Alex
The text was updated successfully, but these errors were encountered: