Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Nov 24, 2022
1 parent 95be570 commit 518cba7
Show file tree
Hide file tree
Showing 10 changed files with 629 additions and 388 deletions.
5 changes: 5 additions & 0 deletions packages/struct-type/.npmfiles
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ dist/cjs/structType.js
dist/cjs/structType.js.map
dist/cjs/typeInfo.js
dist/cjs/typeInfo.js.map
dist/cjs/weakGenerativeCache.js
dist/cjs/weakGenerativeCache.js.map
dist/esm/index.mjs
dist/esm/numbers.mjs
dist/esm/primitives.mjs
dist/esm/struct.mjs
dist/esm/structType.mjs
dist/esm/typeInfo.mjs
dist/esm/weakGenerativeCache.mjs
dist/types/index.d.ts
dist/types/index.d.ts.map
dist/types/numbers.d.ts
Expand All @@ -28,6 +31,8 @@ dist/types/structType.d.ts
dist/types/structType.d.ts.map
dist/types/typeInfo.d.ts
dist/types/typeInfo.d.ts.map
dist/types/weakGenerativeCache.d.ts
dist/types/weakGenerativeCache.d.ts.map
LICENSE
README.md
package.json
2 changes: 1 addition & 1 deletion packages/struct-type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"url": "https://github.com/esfx/esfx/issues"
},
"dependencies": {
"@esfx/type-model": "workspace:*",
"@esfx/equatable": "workspace:*",
"@esfx/type-model": "workspace:*",
"tslib": "^2.4.0"
},
"publishConfig": {
Expand Down
20 changes: 11 additions & 9 deletions packages/struct-type/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
limitations under the License.
*/

import { Equatable, StructuralEquatable } from "@esfx/equatable";
import { conststring, constsymbol, numstr } from "@esfx/type-model";
import * as structType from "./structType.js";
import * as primitives from "./primitives.js";
import { Comparable, Equatable, StructuralComparable, StructuralEquatable } from "@esfx/equatable";
import * as structType from "./structType.js";

/**
* Represents a primitive struct type.
Expand Down Expand Up @@ -137,6 +137,7 @@ export {
float64 as double,
};


export type StructFieldType =
| typeof int8
| typeof int16
Expand All @@ -148,7 +149,8 @@ export type StructFieldType =
| typeof biguint64
| typeof float32
| typeof float64
| ((new () => Struct) & { readonly SIZE: number });
| ((new () => Struct) & { readonly SIZE: number })
;

export interface StructFieldDefinition {
readonly name: conststring | constsymbol;
Expand All @@ -158,7 +160,7 @@ export interface StructFieldDefinition {
/**
* Represents an instance of a struct type.
*/
export type Struct<TDef extends readonly StructFieldDefinition[] = any> =
export type Struct<TDef extends readonly StructFieldDefinition[] = any> =
& Equatable
& StructuralEquatable
& {
Expand Down Expand Up @@ -200,7 +202,7 @@ export type Struct<TDef extends readonly StructFieldDefinition[] = any> =
/**
* Writes the value of this struct to an array buffer.
*/
writeTo(buffer: ArrayBufferLike, byteOffset?: number): void;
writeTo(buffer: ArrayBufferLike, byteOffset?: number, isLittleEndian?: boolean): void;
}
& {
/**
Expand Down Expand Up @@ -250,10 +252,10 @@ export type StructInitElements<TDef extends readonly StructFieldDefinition[]> =
*/
export interface StructType<TDef extends readonly StructFieldDefinition[] = any> {
new (): Struct<TDef>;
new (shared: boolean): Struct<TDef>;
new (buffer: ArrayBufferLike, byteOffset?: number): Struct<TDef>;
new (object: Partial<StructInitProperties<TDef>>, shared?: boolean): Struct<TDef>;
new (elements: Partial<StructInitElements<TDef>>, shared?: boolean): Struct<TDef>;
new (shared: boolean, isLittleEndian?: boolean): Struct<TDef>;
new (buffer: ArrayBufferLike, byteOffset?: number, isLittleEndian?: boolean): Struct<TDef>;
new (object: Partial<StructInitProperties<TDef>>, shared?: boolean, isLittleEndian?: boolean): Struct<TDef>;
new (elements: Partial<StructInitElements<TDef>>, shared?: boolean, isLittleEndian?: boolean): Struct<TDef>;
readonly SIZE: number;
}

Expand Down
Loading

0 comments on commit 518cba7

Please sign in to comment.