lang: Fix using const generics with `declare_program!` (#2965)
This commit is contained in:
parent
460a16171a
commit
460869bf10
|
@ -26,6 +26,7 @@ The minor version will be incremented upon a breaking change and the patch versi
|
|||
- idl: Fix path resolution of the `Cargo.lock` of the project when generating idls for external types ([#2946](https://github.com/coral-xyz/anchor/pull/2946)).
|
||||
- idl: Fix potential panic on external type resolution ([#2954](https://github.com/coral-xyz/anchor/pull/2954)).
|
||||
- lang: Fix using defined types in instruction parameters with `declare_program!` ([#2959](https://github.com/coral-xyz/anchor/pull/2959)).
|
||||
- lang: Fix using const generics with `declare_program!` ([#2965](https://github.com/coral-xyz/anchor/pull/2965)).
|
||||
|
||||
### Breaking
|
||||
|
||||
|
|
|
@ -104,8 +104,15 @@ pub fn convert_idl_type_def_to_ts(
|
|||
.generics
|
||||
.iter()
|
||||
.map(|generic| match generic {
|
||||
IdlTypeDefGeneric::Type { name } => format_ident!("{name}"),
|
||||
IdlTypeDefGeneric::Const { name, ty } => format_ident!("{name}: {ty}"),
|
||||
IdlTypeDefGeneric::Type { name } => {
|
||||
let name = format_ident!("{}", name);
|
||||
quote! { #name }
|
||||
}
|
||||
IdlTypeDefGeneric::Const { name, ty } => {
|
||||
let name = format_ident!("{}", name);
|
||||
let ty = format_ident!("{}", ty);
|
||||
quote! { const #name: #ty }
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
if generics.is_empty() {
|
||||
|
|
Loading…
Reference in New Issue