Use GenericEmbedded for embedded schemas

This commit is contained in:
Tony Garnock-Jones 2021-12-12 23:52:31 +01:00
parent 8b7ea7c589
commit 972085a59b
2 changed files with 4 additions and 4 deletions

View File

@ -18,10 +18,10 @@ export function compile(
): string { ): string {
const mod = new ModuleContext(env, modulePath, schema, options); const mod = new ModuleContext(env, modulePath, schema, options);
mod.definePreamble(`let __schema: _.Value<unknown> | null = null;`); mod.definePreamble(`let __schema: _.Value | null = null;`);
mod.definePreamble(seq(`export function _schema() `, block( mod.definePreamble(seq(`export function _schema() `, block(
seq(`if (__schema === null) `, block( seq(`if (__schema === null) `, block(
`__schema = _.decode(_.Bytes.fromHex("${encode(fromSchema(schema)).toHex()}"))`)), `__schema = _.decode<_.GenericEmbedded>(_.Bytes.fromHex("${encode(fromSchema(schema)).toHex()}"))`)),
`return __schema`))); `return __schema`)));
const embeddedName = schema.embeddedType; const embeddedName = schema.embeddedType;

File diff suppressed because one or more lines are too long