Skip to content

Fields are incorrectly extending Entry #108

Open
@asimpson

Description

@asimpson

My generated type looks something like this:

export interface Link
  extends Entry<LinkFields> {
  sys: {--snip--};
}

LinkFields looks something like this:

export interface LinkFields {
  /** Link Text */
  linkText: string;

  /** Link */
  link: string;
}

and for reference, Entry's type signature is this:

export interface Entry<T> {
    sys: Sys;
    fields: T;
    metadata: Metadata;
    toPlainObject(): object;
    update(): Promise<Entry<T>>;
}

Entry includes toPlainObject and update neither of which are present on fields of an Entry (to the best of my understanding).

My understanding of the "resolved" type signature looks like this:

interface Link {
    sys: {--snip--};
    fields: {
      /** Link Text */
      linkText: string;

      /** Link */
      link: string;
    };
    metadata: Metadata;
    toPlainObject(): object;
    update(): Promise<Entry<T>>;
}

This is incorrect, it should be something like this:

interface Link {
    sys: {--snip--};
    fields: {
      /** Link Text */
      linkText: string;

      /** Link */
      link: string;
    };
    metadata: Metadata;
}

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