Skip to content

Several generics default to any instead of their base type #192

@mootari

Description

@mootari

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:

Field<T extends DataType = any>

Unfortunately this effectively removes all type guarantees when properties that inherit the type are passed down. Example (playground link):

import type {Field, DataType} from "apache-arrow";

"not a type" satisfies Field["type"]; // Does not error
"not a type" satisfies Field<DataType>["type"]; // Errors

The generics should instead define their base type as default type:

Field<T extends DataType = DataType>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions