Skip to content

Commit

Permalink
ts: allow nullable types for option fields (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmt authored Feb 10, 2022
1 parent 44ce9d8 commit 3838bde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ incremented for features.

## [Unreleased]

### Fixes

* ts: Allow nullable types for `Option<T>` mapped types ([#1428](https://github.com/project-serum/anchor/pull/1428)).

### Breaking

* lang: Enforce that the payer for an init-ed account be marked `mut` ([#1271](https://github.com/project-serum/anchor/pull/1271)).
Expand Down
2 changes: 1 addition & 1 deletion ts/src/program/namespace/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export type DecodeType<T extends IdlType, Defined> = T extends keyof TypeMap
: T extends { option: { defined: keyof Defined } }
? Defined[T["option"]["defined"]] | null
: T extends { option: keyof TypeMap }
? TypeMap[T["option"]]
? TypeMap[T["option"]] | null
: T extends { vec: keyof TypeMap }
? TypeMap[T["vec"]][]
: T extends { array: [defined: keyof TypeMap, size: number] }
Expand Down

0 comments on commit 3838bde

Please sign in to comment.