Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SArray does not extends Array<T> #9

@michal-minich

Description

@michal-minich

from index.d.ts:

export interface SArray<T> {... }
export interface SDataArray<T> extends SArray<T>

I would proffered this be written as:

export interface SArray<T> extends ReadonlyArray<T> { 
   // only S-Array specific function mentioned here
}
export interface SDataArray<T> extends SArray<T>, Array<T> { 
   // only S-Array specific function mentioned here
}

Obviously the implication are

  1. The additional function and their overloads presented in Readonly/Array would need to be implemented in S-Array.
  2. Existing functions with different signatures would need to be changed or overloads added
    • I experienced this issues with .map function, when used with more than 1 argument.

The reason is this would allow general (generic) function to be written that can handled both types. Also converting code to-and-from standard array / s-array.

What is your opinion?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions