mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 16:32:41 +00:00
Improve TS types to support isolatedModules and isolatedDeclarations
This commit is contained in:
@@ -5,7 +5,7 @@ export {
|
||||
SIZE_PREFIX_LENGTH,
|
||||
} from './constants.js';
|
||||
|
||||
export {IGeneratedObject, IUnpackableObject, Offset, Table} from './types.js';
|
||||
export type {IGeneratedObject, IUnpackableObject, Offset, Table} from './types.js';
|
||||
|
||||
export {float32, float64, int32, isLittleEndian} from './utils.js';
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ export class StackValue {
|
||||
this.offset = newOffset;
|
||||
}
|
||||
|
||||
storedWidth(width = BitWidth.WIDTH8): BitWidth {
|
||||
storedWidth(width: BitWidth = BitWidth.WIDTH8): BitWidth {
|
||||
return isInline(this.type) ? Math.max(width, this.width) : this.width;
|
||||
}
|
||||
|
||||
storedPackedType(width = BitWidth.WIDTH8): ValueType {
|
||||
storedPackedType(width: BitWidth = BitWidth.WIDTH8): ValueType {
|
||||
return packedType(this.type, this.storedWidth(width));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const int32 = new Int32Array(2);
|
||||
export const float32 = new Float32Array(int32.buffer);
|
||||
export const float64 = new Float64Array(int32.buffer);
|
||||
export const isLittleEndian =
|
||||
export const int32: Int32Array = new Int32Array(2);
|
||||
export const float32: Float32Array = new Float32Array(int32.buffer);
|
||||
export const float64: Float64Array = new Float64Array(int32.buffer);
|
||||
export const isLittleEndian: boolean =
|
||||
new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
|
||||
|
||||
Reference in New Issue
Block a user