Skip to content

Issue with JSONColumnType #453

@dsfcoll

Description

@dsfcoll

Hello!
I ran into an issue with the branded JSON type.

Example:

@Column({ type: 'jsonb', nullable: true })
videos: JSONColumnType<{
  [key: string]: {
    size: number;
    bitrate: number;
    dimensions: number[];
    resolution: number;
    metadataSize: number;
  };
}>;

But when we call Object.values(entity.videos), we get an unexpected type:

({
  size: number;
  bitrate: number;
  dimensions: number[];
  resolution: number;
  metadataSize: number;
} | symbol)[]

The issue is the | symbol part. Because of this symbol in the union, we can't easily iterate — every access requires an additional if check.

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