winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.06k stars 198 forks source link

Unable to convert a recursive struct from JSON #7126

Open eladb opened 2 months ago

eladb commented 2 months ago

I tried this:

struct Node {
  id: str;
  children: Map<Node>?;
}

Node.fromJson({
  id: "foo",
  children: {},
});

This happened:

undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at compileForPreflight (/Users/eladb/.bun/install/global/node_modules/@winglang/compiler/dist/index.js:454:28)
    at async Object.compile (/Users/eladb/.bun/install/global/node_modules/@winglang/compiler/dist/index.js:339:37)
    at async recompile (/Users/eladb/.bun/install/global/node_modules/@wingconsole/server/dist/index.js:44724:56)

I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

No response

Node.js Version

No response

Platform(s)

No response

Community Notes