Closed Offroaders123 closed 1 year ago
I think this can nearly be closed. The only issue that is currently present with this, is that the NBTData
options generic parameter won't inherit the options of a parent NBTData
object, if you were to use that as a format options object.
declare const data: Uint8Array;
const template = await NBT.read<any,{ endian: "big" }>(data);
const shadowed = new NBT.NBTData({},template);
shadowed.name; // Name
shadowed.endian; // "big"
Welp, after writing that out, and trying it over in VSCode, looks like it is working now! Maybe this can be closed sooner than I thought! Going to investigate some more that it is indeed working properly, before I actually formally close this one.
Reference: d5f3b44
I haven't quite figured out how to merge the values of a generic from it's default type, and with that of those provided by the caller. Here's a better demo for that:
This has to do with how I'm implementing the generic types for the
NBTData
object, specifically theU
generic which is of the typeFormatOptions
. See how that is implemented as of this issue, here.