0

I am new to Typescript. I am looking to access the object in my Typescript code. In my code, the target object will be decided at runtime based on the argument.

const obj123 = {
   id: 12,
   colour: 'blue'
 }

const obj111 = {
   id: 15,
   colour: 'black'
 }

class test {
  getValue(objId: string) {
   // need to access either obj123 or obj111 based on the value of 'objId' here 
    }
 }

0 Answers0