Skip to content

Property access issues for properties typed as object #90

@lorenzocestaro

Description

@lorenzocestaro

Trying to access any object property that is typed as object will lead to typescript errors like:

Property 'x' does not exist on type 'object'.ts(2339)

In my specific case, I am trying to fetch images from a folder using the SDK and accessing image.embeddedMetadata?.title, which raises the type error above.

Could it be taken into consideration the possibility of specifying types a bit more, where properties are currently typed as object? For example by using Record<string, string | number> or maybe even more specific when the structure of a property is well-defined, I am thinking versionInfo might be one of these cases where it could be typed as { name: string; id: string }

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