data-forge-ts icon indicating copy to clipboard operation
data-forge-ts copied to clipboard

Tyopescript compatible new column / generateSeris

Open YousefED opened this issue 3 years ago • 1 comments

I've tried the examples at https://github.com/data-forge/data-forge-ts/blob/master/docs/guide.md#generating-a-column, but both options don't work nicely with TypeScript

  • The first option (withSeries) doesn't compile (see below)
  • The second option (generateSeries), doesn't result in a DataFrame with the correct type

(compilation error:

TS2322: Type '(df: IDataFrame<any, any>) => IDataFrame<any, any>' is not assignable to type 'ISeries<any, any> | SeriesSelectorFn<any, any, any>'.   Type '(df: IDataFrame<any, any>) => IDataFrame<any, any>' is not assignable to type 'SeriesSelectorFn<any, any, any>'.     Type 'IDataFrame<any, any>' is missing the following properties from type 'ISeries<any, any>': amountRange, proportionRange, percentRange, amountChange, and 24 more.

)

What's the typescript-way to add a new column based on the existing df?

YousefED avatar May 29 '22 17:05 YousefED

Please submit example code so I can diagnose the error.

ashleydavis avatar May 29 '22 21:05 ashleydavis