Skip to content

Observations property on series data gives static type checking error #110

@sjunel

Description

@sjunel

Hi @pastorsj!

I've pulled series data using the getObservationsForSeries method and I'm trying to use the filter method on data accessed via the observations property. A static type checking error is blocking me from transpiling.

The code I'm using is:

const series = await fred.series.getObservationsForSeries('SP500');

let data = series.observations.filter((obj: any) => {
  // test implementation
});

And the error I'm getting is:

src/app.ts:31:36 - error TS2339: Property 'filter' does not exist on type 'ObservationSet'.

31     let data = series.observations.filter((obj: any) => {
                                      ~~~~~~

I double checked the wrapper documentation, and it does says that the returned JSON's observations property has a value of an array of objects, so it's odd that I'm not able to use an array method.

Would appreciate it if you looked into this! Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions