FieldLayout
On this page

FieldLayout

Interface in Reflection

One struct field's byte layout: its name, its DSL type key (the string typeKey returns), and its offset, align and size in bytes under the LayoutKind the enclosing StructLayout was computed with.

import type { FieldLayout } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

interface FieldLayout {
readonly name: string;
readonly emitted: string;
readonly type: string;
readonly offset: number;
readonly align: number;
readonly size: number;
}

Description

A packer that writes Float32Array slots divides offset by 4; every type this engine lays out is at least 4-byte aligned, so the division is exact.

Instance properties

nameread only string

The field’s authored name, the one the host reads by.

emittedread only string

The field’s name in the emitted text (Rule 11.10). Equal to name when the target spells it as written.

typeread only string
offsetread only number
alignread only number
sizeread only number

See also

Source

src/core/reflect/layout.ts, line 153, at commit af54ddad5

Edit this page Report a problem