Skip to content

Support Non-Empty Arrays #22

@anthonyjoeseph

Description

@anthonyjoeseph

🚀 Feature request

Support NonEmptyArray (from fp-ts) as being a tuple with [0] defined as well as a traversable & indexable array

Current Behavior

nonempty arrays are treated like normal arrays

Desired Behavior

const a: NonEmptyArray<string> = ["abc", "def"]
const x: string = pipe(a, get("a.[0]"))
const y: Option<string> = pipe(a, get("a.[number]", 1))

Suggested Solution

Update Paths and Build (I think AtPath should work properly as-is)

Who does this impact? Who is this for?

Users of NonEmptyArray

Describe alternatives you've considered

try to support other implementations of NonEmptyArray as well (which would be safe, since we require typescript >v4.0).

Additional context

Your environment

Software Version(s)
spectacles-ts 1.0.6
fp-ts 2.11
TypeScript 4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions