fix(Array, {HeadlessType})

This commit is contained in:
2025-08-06 16:20:14 +03:00
parent 35a98456ef
commit 16789a942e
12 changed files with 246 additions and 74 deletions

18
types/index.d.ts vendored
View File

@ -28,14 +28,6 @@ export function serialize(dv: DataView, src: Serializable, ...types: Serializabl
*/
export function parse(dv: DataView, ...types: SerializableType[]): Serializable;
/**
* some types, like Array, String, has no fixed size. So in Structure they are stored as u32 offset, which points to their beginning
* @param {Serializable} obj to check
* @param {SerializableType[]} ...types primary and inner types. eg: Array, Number
* @returns {boolean}
*/
export function isHeadless(obj: Serializable, ...types: SerializableType[]): boolean;
/**
* some types, like Array, String, has no fixed size. So in Structure they are stored as u32 offset, which points to their beginning
* @param {SerializableType[]} ...types primary and inner types. eg: Array, Number
@ -43,14 +35,6 @@ export function isHeadless(obj: Serializable, ...types: SerializableType[]): boo
*/
export function isHeadless(...types: SerializableType[]): boolean;
/**
* if obj has no fixed size, return 4 (sizeof u32 offset)
* @param {Serializable} obj to check
* @param {SerializableType[]} ...types primary and inner types. eg: Array, Number
* @returns {number}
*/
export function sizeofHead(obj: Serializable, ...types: SerializableType[]): number;
/**
* if obj has no fixed size, return 4 (sizeof u32 offset)
* @param {SerializableType[]} ...types primary and inner types. eg: Array, Number
@ -71,3 +55,5 @@ export function sizeof(obj: Serializable, ...types: SerializableType[]): number;
* @throws {Error} if passed Array, String, DataView type (unknown sizeof)
*/
export function sizeof(...types: SerializableType[]): number;
export function isSerializableType(type: unknown): boolean;