V
V
VicTHOR2019-11-13 13:23:24
Node.js
VicTHOR, 2019-11-13 13:23:24

How to make json friends with TS and NODE JS?

I'm just getting acquainted with TS, I need to read a json file, work with it as an object, and overwrite it.
In order to connect json as a module on TS, I registered it and configured it in tsconfigimport * as test from './foo/bar.json';

"resolveJsonModule": true,
"moduleResolution": "node"

This construction does not throw errors and the code compiles. However, when I run the final file, I get the error "Unexpected token *" , I looked at the final code - and the import line has not changed there ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2019-11-13
@VicTHOR

you can add
more
"target": "ES2015"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question