NBTify icon indicating copy to clipboard operation
NBTify copied to clipboard

ArrayTag Generic Types

Open Offroaders123 opened this issue 6 months ago • 2 comments

Looking into a few different ways to accomplish representing tuple types with TypedArray-based NBT key types.

Right now the standard library types don't provide anything like tuple support for TypedArray values. I'd like to be able to do something like Int8Array<[number, number]>, and only allow access of those two properties, just like the regular Array tuple type notation allows for ([number, number] on it's own).

I've encountered a few places where this would be a great help at type validation, namely things like player NBT UUID fields, which would be IntArrayTag<[number, number, number, number]>, as well as position tuple fields, which tend to be what would be described with IntArrayTag<[number, number, number]>.

Offroaders123 avatar Jan 04 '24 09:01 Offroaders123