There are many causes for the issue, as mentioned in other answer.
In my case, the error could be resolved by adding the following reference around the top of the .ts/.tsx file.
///