Microsoft MakeCode

Type 'undefined[]' is not assignable to type 'number'

I was working on a small project when Arcade started refusing to run the project. I scanned my code for any exclamation marks but nothing was found. Thinking it was just a small problem like a tile was undefined or something, I quickly switched to JavaScript mode. There I found this:

image

There were 6 errors. Intellisense said Type 'undefined[]' is not assignable to type 'number'. for each one. I just got this after modifying something completely unrelated.

Any idea why this happened?

Ah, never mind. Replacing the [] in the problematic statements with null did the trick.

Now I can go back to my blocks and start moving everything back, because Arcade moved everything around again!

3 Likes

I saw the same thing happen yesterday. I’m guessing there was a glitch in the editor. I can’t remember exactly what I was doing at the time, but I think I defined an array within a function in javascript, went to blocks, and the game didn’t run, and when I went back I saw the same errors. Luckily it happened when I had just started changing things, so I could just revert those changes in GitHub.

1 Like

Yes, this is absolutely a bug. Usually refreshing the page (in the blocks editor) fixes it

2 Likes