apache / apache/arrow-js

Several generics default to `any` instead of their base type

Open
#192 4 comments 0 reactions 0 assignees View on GitHub
Type: bug
Dominant language
TypeScript
Stars
112
Forks
23
Avg merge
21h 18m
Merged PRs (30d)
8

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Several Generics have `any` set as default value instead of defaulting to the type from which they extend, like the following example:
```ts
Field
```

Unfortunately this effectively removes all type guarantees when properties that inherit the type are passed down. Example ([playground link](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3gMWCgNgEwBo4ARAQxjIBVkUBfOAMyghDgCIywyBjACxQBaMlBYB3dgG4AUNPYA7CPDIJa7OAGcKwDYxwa42PPgDa7JKnYBdSXAD0d0hBQHF8FKOhy3cFRZTqWjA6ei6GOAQAPOSUNKgAfGb+1rYOcACinlAa0kA)):
```ts
import type {Field, DataType} from "apache-arrow";

"not a type" satisfies Field["type"]; // Does not error
"not a type" satisfies Field["type"]; // Errors
```

The generics should instead define their base type as default type:
```ts
Field
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.