insidesherpa / JPMC-tech-task-3-PY3

8 stars 176 forks source link

Issues with Row[] #45

Closed KMurray26 closed 4 years ago

KMurray26 commented 4 years ago

During the compilation of my program, I was presented with the following error code, **Type error: Type '{ price_abc: number; price_def: number; ratio: number; timestamp: Date; upper_bound: number; lower_bound: number; trigger_alert: number | undefined; }' is not assignable to type 'Row[]'. Object literal may only specify known properties, and 'price_abc' does not exist in type 'Row[]'. TS2322

20 |     const lowerBound = 1 - 0.05;
21 |     return {

22 | price_abc: priceABC, | ^ 23 | price_def: priceDEF, 24 | ratio, 25 | timestamp: serverResponds[0].timestamp > serverResponds[1].timestamp ?

Through previous issue posts, I realised this was due to having square brackets after row, and so once they were removed, I ran into another issue within Graph.tsx: Type error: Argument of type 'Row' is not assignable to parameter of type 'TableData'. Type 'Row' is not assignable to type '{ [key: string]: string; }'. Index signature is missing in type 'Row'. TS2345

52 |     if (this.table) {
53 |       this.table.update(

54 | DataManipulator.generateRow(this.props.data), | ^ 55 | ); 56 | } 57 | }** I am unable to figure out how to fix this error, any help would be appreciated

wafakhan9232 commented 4 years ago

Solved: That is because you are missing the square brackets before DataManipulator.generate. If you look carefully at the screenshot attached, you will get what I mean. Hope this solves your issue. task3_issue

Richrich435 commented 2 years ago

Hello, @wafakhan9232 I attempted your solution and that still did not fix the problem. Is there any alternative to it? image