title: Typescript: No index signature with a parameter of type 'string' was found on type '{ "A": string; }
body: <p>I have some vanilla javascript code that takes a string input, splits the string into characters, and then matches those characters to a key on an object.</p>
  
  <pre><code>DNATranscriber = {
      "G":"C",
      "C": "G",
      "T": "A",
      "A": "U"
  }
  function toRna(sequence){
      const sequenceArray = [...sequence];
      const transcriptionArray = sequenceArray.map(character =&gt;{
          return this.DNATranscriber[character];
      });
  
      return transcriptionArray.join("");
  }
  
  console.log(toRna("ACGTGGTCTTAA")); //Returns UGCACCAGAAUU
  </code></pre>
  
  <p>This works as expected. I'd now like to convert this to typescript. </p>
  
  <pre><code>class Transcriptor {
      DNATranscriber = {
         G:"C",
         C: "G",
         T: "A",
         A: "U"
      }
      toRna(sequence: string) {
          const sequenceArray = [...sequence];
          const transcriptionArray = sequenceArray.map(character =&gt;{
              return this.DNATranscriber[character];
          });
      }
  }
  
  export default Transcriptor
  </code></pre>
  
  <p>But I'm getting the following error. </p>
  
  <blockquote>
    <p>Element implicitly has an 'any' type because expression of type 'string' >can't be used to index type '{ "A": string; }'.
    No index signature with a parameter of type 'string' was found on type >'{ "A": string; }'.ts(7053)</p>
  </blockquote>
  
  <p>I thought that the issue was that I needed my object key to be a string. But converting them to strings didn't work. </p>
  
  <pre><code>DNATranscriber = {
         "G":"C",
         "C": "G",
         "T": "A",
         "A": "U"
      }
  </code></pre>
  
  <p>I'm quite confused by this. It says that no index signature with a type of string exists on my object. But I'm sure that it does. What am I doing wrong?</p>
  
  <p>Edit - I solved this by giving the DNATranscriber object a type of any.</p>
  
  <pre><code>DNATranscriber: any = {
      "G":"C",
      "C":"G",
      "T":"A",
      "A":"U"
  }
  </code></pre>