Microsoft MakeCode

Type annotation cannot appear on a constructor declaration

Im trying out some stuff for a project and I have found it that I would prefer to use classes for the thing im doing. The problem occurs when having a constructor. It then returns me with a error “Line 3: Type annotation cannot appear on a constructor declaration.”.

Here is the test code: https://pastebin.com/jxFhZ01Y

I also tried to do it according to the microbit python docs. But that returns me with “Line 4: the field ‘string’ of ‘Testclass’ is static; Line 7: the field ‘string’ of ‘Testclass’ is static”

Here is the code for that: https://pastebin.com/RatUxV7f

1 Like