TypeScript Cannot find name for 'JSON'
h
mwilki7 (152)

I'm attempting to get a simple NodeJS server programmed in TypeScript to send a client a json string but I get this error message:

index.ts:17
app.get('/', function (req : any, res : any)
                                              ^
TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at Socket.<anonymous> (index.ts:17:47)
    at Socket.emit (events.js:198:13)
    at Socket.EventEmitter.emit (domain.js:448:20)
    at /home/runner/node_modules/socket.io/lib/socket.js:528:12
    at process._tickCallback (internal/process/next_tick.js:61:11)

Also, another error message appears under all lines that say 'JSON'


According to :
https://github.com/TypeStrong/atom-typescript/issues/1211
it says this issue is supposed to be fixed if JSON is the one causing the problem.

Anyone know what's wrong with the program?

You are viewing a single comment. View All
Answered by Klokat (41) [earned 5 cycles]
View Answer
Klokat (41)

@mwilki7 Honestly I have no idea why that happens. It happened to me a couple of times. But it fixed itself? I have no idea.
https://repl.it/@Klokat/TypeScriptTesting-Works
Try it here. You'll need a font to render text from the server because as far as I can tell the instance that repl.it serves doesn't come with fonts. But I'm getting this

so it's probably alright.