From 7900352a9665b0282a3c7fc8f8149c141ebad1da Mon Sep 17 00:00:00 2001 From: Daniel Marin Date: Thu, 10 Feb 2022 13:51:21 +0000 Subject: [PATCH 1/3] fix(ts): allow nullable types for option fields. --- ts/src/program/namespace/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/src/program/namespace/types.ts b/ts/src/program/namespace/types.ts index 5c80411abc..be278dfde6 100644 --- a/ts/src/program/namespace/types.ts +++ b/ts/src/program/namespace/types.ts @@ -107,7 +107,7 @@ export type DecodeType = 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] } From 729542f3c909c980a71b5d6831ffefca50b6c849 Mon Sep 17 00:00:00 2001 From: Daniel Marin Date: Thu, 10 Feb 2022 14:30:21 +0000 Subject: [PATCH 2/3] docs(ts): add change to CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1af4996d2b..4a78326844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ incremented for features. ## [Unreleased] +### Fixes + +* ts: Allow nullable types for `Option` 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)). From a03a5dc6ec25b24358e74d29a565b342af6f71eb Mon Sep 17 00:00:00 2001 From: Armani Ferrante Date: Thu, 10 Feb 2022 09:46:28 -0500 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a78326844..f64a2f3b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ incremented for features. ### Fixes -* ts: Allow nullable types for `Option` mapped types. ([#1428](https://github.com/project-serum/anchor/pull/1428)) +* ts: Allow nullable types for `Option` mapped types ([#1428](https://github.com/project-serum/anchor/pull/1428)). ### Breaking