I'm trying to make a function that returns string
from mapping(uint256 => string) typeToURI;
but I keep getting an error from Remix Ethereum IDE
:
TypeError: Return argument type uint256[] storage ref is not implicitly convertible to expected type (type of first return variable) string memory. --> NFT Minter.sol:88:16: | 88 | return typeToToken[tokenType]; | ^^^^^^^^^^^^^^^^^^^^^^
I know I should use the memory
type somewhere to fix this issue but I don't know where.
I have tried putting memory
type in mapping : mapping(uint256 => memory string) typeToURI;
but it didn't worked and it causes another error.
source code:
mapping(uint256 => string) tokenToURI;
function tokenTypeURI(uint256 tokenType) public
returns (string memory)
{
return typeToToken[tokenType];
}