Drop Metadata V0-V8 (#2634)
* Drop MetadatV0 * Apply suggestions from code review * Restore asV1 * Remove V0 comment * Handle DoNotConstruct in enum * No imports from DoNotConstruct * Merge & re-generate * Attempt empty construction * Drop Metadata from 0-4 * CHANGELOG * assert(5) * BE vs LE * Metadataall to no-construction * Empty U8a create * Remove old comment * Santize handling * Update CHANGELOG.md * Drop support for Metadata < 9 * Remove old pre-9 definitions * Update CHANGELOG.md * CHANGELOG * Remove v8-era tests * v8 tests
This commit is contained in:
@@ -51,10 +51,12 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
|
||||
const keys = (sub as TypeDef[]).map(({ info, name = '', type }): string => {
|
||||
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
|
||||
const isComplexType = [TypeDefInfo.Tuple, TypeDefInfo.VecFixed].includes(info);
|
||||
const asGetter = type === 'Null'
|
||||
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
|
||||
? ''
|
||||
: createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports);
|
||||
const isGetter = createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
const isGetter = info === TypeDefInfo.DoNotConstruct
|
||||
? ''
|
||||
: createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
|
||||
switch (info) {
|
||||
case TypeDefInfo.Compact:
|
||||
@@ -65,6 +67,9 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
|
||||
case TypeDefInfo.VecFixed:
|
||||
return `${isGetter}${asGetter}`;
|
||||
|
||||
case TypeDefInfo.DoNotConstruct:
|
||||
return '';
|
||||
|
||||
default:
|
||||
throw new Error(`Enum: ${enumName || 'undefined'}: Unhandled type ${TypeDefInfo[info]}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user