From dbbb70dc2a274d9790c667b2e7885df077911950 Mon Sep 17 00:00:00 2001 From: acheron Date: Thu, 19 Sep 2024 23:30:26 +0200 Subject: [PATCH] docs: Add `Option` in Javascript Anchor Types Reference --- docs/src/pages/docs/javascript-anchor-types.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/src/pages/docs/javascript-anchor-types.md b/docs/src/pages/docs/javascript-anchor-types.md index ae45b0656a..ce3e632062 100644 --- a/docs/src/pages/docs/javascript-anchor-types.md +++ b/docs/src/pages/docs/javascript-anchor-types.md @@ -119,4 +119,21 @@ This reference shows you how Anchor maps Rust types to JavaScript/TypeScript typ .init([1, 2, 3]) .rpc(); ``` + +--- +* `Option` +* `T | null | undefined` +* ```javascript + // `null` for `None` + await program + .methods + .init(null) + .rpc(); + + // Non-nullish value for `Option` + await program + .methods + .init(42) + .rpc(); + ``` {% /table %}