fix: overload get method definition (help needed) #617
+6
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current
get
method in both storage and persist map has return typeV | null
.However, if a defaultValue of type V is provided, it won't return null.
I tried to fix the declaration of
get
method with function overloading but get an error when compiling:ERROR TS2391: Function implementation is missing or not immediately following the declaration.
But similar code can compile if using plain typescript.
Doesn't assembly script support function overloading or I did it wrong?