How can i fix the Element Implicity and No index Signature Error?

Solution 1:

You have mixed types of keys in specialCodes and you need to help TS to understand how to get values from there. Something like this:

const specialCodes: Record<number | string, string> = {
      0: ":zero:",
      1: ":one:",
      2: ":two:",
      3: ":three:",
      4: ":four:",
      5: ":five:",
      6: ":six:",
      7: ":seven:",
      8: ":eight:",
      9: ":nine:",
      "#": ":hash:",
      "*": ":asterisk:",
      "?": ":grey_question:",
      "!": ":grey_exclamation:",
      " ": "   ",
    };