Skip to content

Commit

Permalink
docs: Add Option in Javascript Anchor Types Reference
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto committed Sep 19, 2024
1 parent c679b27 commit dbbb70d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/src/pages/docs/javascript-anchor-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,21 @@ This reference shows you how Anchor maps Rust types to JavaScript/TypeScript typ
.init([1, 2, 3])
.rpc();
```

---
* `Option<T>`
* `T | null | undefined`
* ```javascript
// `null` for `None`
await program
.methods
.init(null)
.rpc();
// Non-nullish value for `Option<T>`
await program
.methods
.init(42)
.rpc();
```
{% /table %}

0 comments on commit dbbb70d

Please sign in to comment.