Skip to content

Commit

Permalink
fix(docs): incorrect returns for MutMap.get (#5640)
Browse files Browse the repository at this point in the history
The `MutMap.get` method throws an error and does not return undefined.
  • Loading branch information
meirdev authored Feb 7, 2024
1 parent a97c509 commit 799861c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ source: libs/wingc/src/lsp/completions.rs
detail: "(key: str): T1"
documentation:
kind: markdown
value: "```wing\nget: (key: str): T1\n```\n---\nReturns a specified element from the map.\n### Parameters\n- `key` — `str` — The key of the element to return.\n\n### Returns\nThe element associated with the specified key, or undefined if the key can't be found\n\n### Remarks\nIf the value that is associated to the provided key is an object, then you will get a reference\nto that object and any change made to that object will effectively modify it inside the map."
value: "```wing\nget: (key: str): T1\n```\n---\nReturns a specified element from the map.\n### Parameters\n- `key` — `str` — The key of the element to return.\n\n### Returns\nThe element associated with the specified key, or throw an error if the key can't be found\n\n### Remarks\nIf the value that is associated to the provided key is an object, then you will get a reference\nto that object and any change made to that object will effectively modify it inside the map."
sortText: ff|get
insertText: get($1)
insertTextFormat: 2
Expand Down
2 changes: 1 addition & 1 deletion libs/wingsdk/src/std/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class MutMap {
* @macro ((obj, key) => { if (!(key in obj)) throw new Error(`MutMap does not contain key: "${key}"`); return obj[key]; })($self$, $args$)
*
* @param key The key of the element to return.
* @returns The element associated with the specified key, or undefined if the key can't be found
* @returns The element associated with the specified key, or throw an error if the key can't be found
*/
public get(key: string): T1 {
key;
Expand Down

0 comments on commit 799861c

Please sign in to comment.