zheeeng/export-from-json

Ioption<R> fields ?

Dubuis opened this issue · 2 comments

Hello,

Since 1.3.5, there seems to be a new mandatory property in interface IOption but the documentation doesn't explain what this new property is. The document is outdated or it's a forgotten '?' ?

ERROR in src/app/app.component.ts:399:24 - error TS2345: Argument of type '{ data: any; fileName: any; exportType: "json"; }' is not assignable to parameter of type 'IOption<void>'.
  Property 'fields' is missing in type '{ data: any; fileName: any; exportType: "json"; }' but required in type 'IOption<void>'.

399         exportFromJSON({ data, fileName, exportType });
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/export-from-json/dist/types/exportFromJSON.d.ts:6:5
    6     fields: string[] | {};
          ~~~~~~
    'fields' is declared here.

Based on a quick perusal of exportFromJSON.ts it looks like it is only defined on the interface and not used anywhere.

So, I just passed in fields: [] and called it a day.

It isn't related to generic R, the newly added fields option caused this problem. The latest version fixed by declare fields optional.