-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
44 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
import * as Registry from "./bincode/registry.ts" | ||
|
||
export const SimpleStruct_obj: Registry.SimpleStruct = { a: 42, b: "Hello" } | ||
declare global { | ||
interface Object { | ||
dict<const T>(): T | ||
} | ||
} | ||
Object.prototype.dict = function<const T>(this: T) { | ||
return Object.assign(Object.create(null), this) as T | ||
} | ||
|
||
export const SimpleStruct_obj: Registry.SimpleStruct = { a: 42, b: "Hello" }.dict() | ||
export const SimpleStruct_bin = Uint8Array.from([42, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 72, 101, 108, 108, 111]) | ||
|
||
export const MultiEnum_VariantC_obj: Registry.MultiEnum = { | ||
$: "VariantC", | ||
VariantC: { x: 5, y: 3.14 } | ||
} | ||
VariantC: { x: 5, y: 3.14 }.dict() | ||
}.dict() | ||
|
||
export const MultiEnum_VariantC_bin = Uint8Array.from([2, 0, 0, 0, 5, 31, 133, 235, 81, 184, 30, 9, 64]) | ||
|
||
export const MultiEnum_Unit_obj: Registry.MultiEnum = { $: "UnitVariant", UnitVariant: null } | ||
export const MultiEnum_Unit_obj: Registry.MultiEnum = { $: "UnitVariant", UnitVariant: null }.dict() | ||
export const MultiEnum_Unit_bin = Uint8Array.from([3, 0, 0, 0]) | ||
|
||
export const ComplexStruct_obj: Registry.ComplexStruct = { | ||
inner: { a: 42, b: "Hello" }, | ||
inner: { a: 42, b: "Hello" }.dict(), | ||
flag: true, | ||
items: [ | ||
{ $: "VariantA", VariantA: 10 }, | ||
{ $: "VariantB", VariantB: "World" } | ||
{ $: "VariantA", VariantA: 10 }.dict(), | ||
{ $: "VariantB", VariantB: "World" }.dict() | ||
], | ||
unit: null, | ||
newtype: 99, | ||
tuple: [123, 45.67, "Test"], | ||
map: new Map().set(3, 7n) | ||
} | ||
}.dict() | ||
export const ComplexStruct_bin = Uint8Array.from([ | ||
42, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 72, 101, 108, 108, 111, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 87, 111, 114, 108, 100, 99, 0, 0, 0, 123, 0, 0, 0, 246, 40, 92, 143, 194, 213, 70, 64, 4, 0, 0, 0, 0, 0, 0, 0, 84, 101, 115, 116, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0 | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": false, | ||
"noEmit": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
|
This file was deleted.
Oops, something went wrong.