Skip to content

Commit addb99e

Browse files
jtennerdcodeIO
authored andcommitted
Improve offsetof typings (AssemblyScript#659)
1 parent 9cc5608 commit addb99e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

std/assembly/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ declare const __heap_base: usize;
110110
declare function sizeof<T>(): usize;
111111
/** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */
112112
declare function alignof<T>(): usize;
113+
/** Determines the end offset of the given class type. Compiles to a constant. */
114+
declare function offsetof<T>(): usize;
115+
/** Determines the offset of the specified field within the given class type. Compiles to a constant. */
116+
declare function offsetof<T>(fieldName: keyof T | string): usize;
113117
/** Determines the offset of the specified field within the given class type. Returns the class type's end offset if field name has been omitted. Compiles to a constant. */
114118
declare function offsetof<T>(fieldName?: string): usize;
115119
/** Determines the unique runtime id of a class type. Compiles to a constant. */

0 commit comments

Comments
 (0)