I'm playing around with TS and encountered an error when trying to run a test for my code. I have a the following piece of code:
return this._map.get(y)?.get(x)
When I run the code for browser, everything works fine. When I run a test using mocha
, however, it throws an error :
return this._map.get(y)?.get(x);
^
SyntaxError: Unexpected token .
From what I managed to read, I'm supposed to configure tsc
differently for NodeJS environment for things to work, but I was under the impression it was more about module resolution than syntax. Could it be that I need to upgrade to any specific NodeJS version? I've tried Node 10 through 13 but none worked.
What am I missing?