File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
packages/nodes-from-anchor/src Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @codama/nodes-from-anchor " : patch
3+ ---
4+
5+ Add support for Anchor alias types
Original file line number Diff line number Diff line change @@ -76,6 +76,11 @@ export const typeNodeFromAnchorV00 = (idlType: IdlV00Type | IdlV00TypeDefTy): Ty
7676 return enumTypeNodeFromAnchorV00 ( idlType ) ;
7777 }
7878
79+ // Alias.
80+ if ( 'kind' in idlType && idlType . kind === 'alias' && 'value' in idlType ) {
81+ return typeNodeFromAnchorV00 ( idlType . value ) ;
82+ }
83+
7984 // Map.
8085 if (
8186 ( 'hashMap' in idlType && isArrayOfSize ( idlType . hashMap , 2 ) ) ||
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ export type IdlV01TypeDefGenericConst = {
154154 type : string ;
155155} ;
156156
157- export type IdlV01TypeDefTy = IdlV01TypeDefTyEnum | IdlV01TypeDefTyStruct | IdlV01TypeDefTyType ;
157+ export type IdlV01TypeDefTy = IdlV01TypeDefTyAlias | IdlV01TypeDefTyEnum | IdlV01TypeDefTyStruct | IdlV01TypeDefTyType ;
158158
159159export type IdlV01TypeDefTyStruct = {
160160 fields ?: IdlV01DefinedFields ;
@@ -166,6 +166,11 @@ export type IdlV01TypeDefTyEnum = {
166166 variants : IdlV01EnumVariant [ ] ;
167167} ;
168168
169+ export type IdlV01TypeDefTyAlias = {
170+ kind : 'alias' ;
171+ value : IdlV01Type ;
172+ } ;
173+
169174export type IdlV01TypeDefTyType = {
170175 alias : IdlV01Type ;
171176 kind : 'type' ;
Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ export const typeNodeFromAnchorV01 = (idlType: IdlV01Type | IdlV01TypeDefTy): Ty
8282 return enumTypeNodeFromAnchorV01 ( idlType ) ;
8383 }
8484
85+ // Alias.
86+ if ( 'kind' in idlType && idlType . kind === 'alias' && 'value' in idlType ) {
87+ return typeNodeFromAnchorV01 ( idlType . value ) ;
88+ }
89+
8590 // Option.
8691 if ( 'option' in idlType ) {
8792 return optionTypeNodeFromAnchorV01 ( idlType ) ;
You can’t perform that action at this time.
0 commit comments