Skip to content

Typing of deriveEntryForLocale does not allow to return undefined, but it is explicitly mentioned in the README and covered in the source code #1537

@TH-VF

Description

@TH-VF

When using the migration.deriveLinkedEntries function TypeScript complains about undefined return values in the function deriveEntryForLocale.

The README mentions that deriveEntryForLocale may return undefined.

If it returns undefined, the new entry will have no values for the current locale.

There is also an example showing to return early in deriveEntryForLocale.

The source code also actively covers this scenario:

https://github.com/contentful/contentful-migration/blob/main/src/lib/action/entry-derive.ts#L73

But the TypeScript typing (index.d.ts) forbids this.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions