asfimport opened a new issue, #90:
URL: https://github.com/apache/arrow-js/issues/90

   I've been obfuscating the builder types in my application to clear the 
editor issue highlights. However, it seems that the root cause is the way the 
`StructRowProxy` type is 
[created](https://github.com/apache/arrow/blob/25e0dd488ab60417f8f453f648e6ecfeb058f01e/js/src/row/struct.ts#L28).
 It seems that instead of or `|` the type is created with `{}&{`}, and this 
causes the editor to complain.
   
   Let's look at an example.
   ```javascript
   
   interface ValueType extends arrow.TypeMap {
     time: arrow.TimestampMillisecond,
     value: arrow.Float64,
   }
   type Value = {
     time: number,
     value: number,
   }
   const children: (arrow.Field<arrow.DateMillisecond> | 
arrow.Field<arrow.Float64>)[] = [
     new arrow.Field('time', new arrow.TimestampMillisecond()),
     new arrow.Field('value', new arrow.Float64()),
   ]
   const valueDataType: arrow.Struct<any> = new 
arrow.Struct<ValueType>(children) // forcing the Struct type here - without it 
the error message is the same and will just show <any> instead of <ValueType>
   const builder: arrow.StructBuilder<ValueType, null | undefined> = 
arrow.makeBuilder({ type: valueDataType, nullValues: [null, undefined] })
   ...
   const add = (value: Value) => builder.append(value)
   /*
   Argument of type 'Value' is not assignable to parameter of type 
'StructRowProxy<ValueType>'.
     Type 'Value' is missing the following properties from type 
'StructRow<ValueType>': toArray, toJSON, [kRowIndex], [kParent], 
[Symbol.iterator]
   */
   ```
   To prevent editor error highlights, I have to obfuscate the builder type.
   ```javascript
   
   const builder: arrow.Builder = arrow.makeBuilder({ type: valueDataType, 
nullValues: [null, undefined] })
   ```
   
   **Reporter**: [Teodor 
Kostov](https://issues.apache.org/jira/browse/ARROW-16750)
   
   <sub>**Note**: *This issue was originally created as 
[ARROW-16750](https://issues.apache.org/jira/browse/ARROW-16750). Please see 
the [migration documentation](https://github.com/apache/arrow/issues/14542) for 
further details.*</sub>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to