Adjust PortableRegistry objectSpread (#4947)

This commit is contained in:
Jaco
2022-06-17 17:56:02 +03:00
committed by GitHub
parent ce39264b77
commit c05cb79005
@@ -781,7 +781,7 @@ export class PortableRegistry extends Struct implements ILookup {
{}, {},
typeDef, typeDef,
lookupIndex === -1 lookupIndex === -1
? {} ? null
: { : {
lookupIndex, lookupIndex,
lookupName: this.#names[lookupIndex], lookupName: this.#names[lookupIndex],
@@ -799,18 +799,18 @@ export class PortableRegistry extends Struct implements ILookup {
{ {
info: isTuple // Tuple check first info: isTuple // Tuple check first
? TypeDefInfo.Tuple ? TypeDefInfo.Tuple
: TypeDefInfo.Struct : TypeDefInfo.Struct,
sub
}, },
alias.size alias.size
? { alias } ? { alias }
: null, : null,
lookupIndex === -1 lookupIndex === -1
? {} ? null
: { : {
lookupIndex, lookupIndex,
lookupName: this.#names[lookupIndex] lookupName: this.#names[lookupIndex]
}, }
{ sub }
)); ));
} }
@@ -832,12 +832,11 @@ export class PortableRegistry extends Struct implements ILookup {
} }
sub[i] = objectSpread( sub[i] = objectSpread(
{},
typeDef,
{ {
docs: sanitizeDocs(docs), docs: sanitizeDocs(docs),
name: nameField name: nameField
}, },
typeDef,
typeName.isSome typeName.isSome
? { typeName: sanitize(typeName.unwrap()) } ? { typeName: sanitize(typeName.unwrap()) }
: null : null
@@ -850,12 +849,11 @@ export class PortableRegistry extends Struct implements ILookup {
#extractHistoric (_: number, type: Type): TypeDef { #extractHistoric (_: number, type: Type): TypeDef {
return objectSpread( return objectSpread(
{},
getTypeDef(type),
{ {
displayName: type.toString(), displayName: type.toString(),
isFromSi: true isFromSi: true
} },
getTypeDef(type)
); );
} }