winglang / winglang/wing

invalid Json object results the wrong error in VSCode

Open
#5,233 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 bug 🐶 dogfood 🔌 vscode-extension
Dominant language
TypeScript
Stars
5.4k
Forks
215
Avg merge
2h 9m
Merged PRs (30d)
27

Description

I tried this:

This json is invalid (test in not defined):

class TestJson {

    pub inflight testJson (): Json  {
        return {
            "test": test,
        };
    }
}
This happened:
Screenshot 2023-12-17 at 9 27 10
I expected this:

when trying to compile the code above, the compiler throws the correct error:
Screenshot 2023-12-17 at 9 29 18

Is there a workaround?

compile and see the correct error

Anything else?

No response

Wing Version

0.51.12

Node.js Version

v19.3.0

Platform(s)

MacOS

Community Notes
  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Wing code in VSCode and compiling it with Wing 0.51.12 on the reported setup. Compare the diagnostic for the undefined test identifier with the incorrect JSON-related error; done means the compiler or VSCode integration reports the expected error for this invalid object.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.