Multiple Actors Tutorial - type error

With SDK v.0.6.10 I see the following build type error:

type error, an actor or actor class must be the only non-imported declaration in a program

There is also a hint saying

(This is a limitation of the current version.)

What is a non-imported declaration in a program? I am copying and pasting the code from the tutorial mutiple actors.

1 Like

I’m pretty sure you need to move the type and function declarations inside your actor in source/assistant/ Tagging @alexa.smith to propagate this change to the Tutorial


That was it. Thanks @cryptoschindler.

It works if the type declaration ToDo and functions add and show are in the actor block after the variables todos and nextId have been declared. I wanted to paste the full actor snippet but received a 403. :smiley_cat:

1 Like

Same applies to the Adding a stylesheet tutorial. The type declarations need to be within the actor block.

I still have no clue how motoko works :tada: except for that.

1 Like

Thanks @factorlive and @cryptoschindler for these catches! Our docs are open source, so please feel free to open PRs when you find fixes like these: I’ve also passed along to the team.


Ok @alexa.smith. Well, I did this for linkedup now. Hope this is still the right way as obviously somebody did like to declare types before that coder got started with the actor block according to the examples.


Thanks Patrick, I think we’d all been organising things this way, with the types outside, it’s only a very recent change to the sdk that prohibited it…!

1 Like

Static typing fashion is en vogue for a reason and can make actors much more maintainable. So thanks for outlining all the concepts in detail in the documentation. It is a good read.