Effect CommunityEC
Effect Community3y ago
6 replies
Patrick Roza

[A, …A[]] extensions

hi @0x706b would there be [A, ...A[]] extension fix possible?
/** @tsplus type NEARR */
export type NonEmptyArray<A> = [A, ...A[]]

/** @tsplus type NEROARR */
export type NonEmptyReadOnlyArray<A> = readonly [A, ...A[]]

/**
 * @tsplus getter NEROARR hello
 */
export function hello() {
  return 1
}


const nonEmpty: NonEmptyReadOnlyArray<number> = [1, 2]
const nonEmptyBad1: NonEmptyArray<number> = [1, 2]
const nonEmptyBad2: [number, ...number[]] = [1, 2]
const nonEmptyBad3: readonly [number, ...number[]] = [1, 2]

nonEmpty.hello
nonEmptyBad1.hello
nonEmptyBad2.hello
nonEmptyBad3.hello
Was this page helpful?