0

I am trying to access property of an object inside the same object with "this" keyword.

Example

const obj = {
  a: "1",
  b: "2",
  c: this.b,
};

But when I do so, TypeScript gives the error:

Property "" does not exist on type never.

How do I resolve this?

kelsny
  • 23,009
  • 3
  • 19
  • 48
Dharmik soni
  • 343
  • 2
  • 16

0 Answers0