ts: fill in some gaps for ts IDL types (#1393)
This commit is contained in:
parent
ba131265f8
commit
9fea72e701
|
@ -14,6 +14,7 @@ incremented for features.
|
|||
### Fixes
|
||||
|
||||
* ts: Fix the root type declaration of the `Wallet` / `NodeWallet` class. ([#1363](https://github.com/project-serum/anchor/pull/1363))
|
||||
* ts: Improve type mapping of Account fields into Typescript with additional support for `Option<T>` and `Vec<String>` types. ([#1393](https://github.com/project-serum/anchor/pull/1393))
|
||||
|
||||
### Features
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ export type MethodsFn<
|
|||
type TypeMap = {
|
||||
publicKey: PublicKey;
|
||||
bool: boolean;
|
||||
string: string;
|
||||
} & {
|
||||
[K in "u8" | "i8" | "u16" | "i16" | "u32" | "i32"]: number;
|
||||
} &
|
||||
|
@ -105,6 +106,8 @@ export type DecodeType<T extends IdlType, Defined> = T extends keyof TypeMap
|
|||
? Defined[T["defined"]]
|
||||
: T extends { option: { defined: keyof Defined } }
|
||||
? Defined[T["option"]["defined"]] | null
|
||||
: T extends { option: keyof TypeMap }
|
||||
? TypeMap[T["option"]]
|
||||
: T extends { vec: keyof TypeMap }
|
||||
? TypeMap[T["vec"]][]
|
||||
: T extends { array: [defined: keyof TypeMap, size: number] }
|
||||
|
|
Loading…
Reference in New Issue