[M0072] field does not exist on type

...dfx-env/token-lobby/src/tictactoe/game.mo:104.31-104.32: type error [M0072], field Cell does not exist in type
  module {
    type Cell = {#Empty; #O; #X};
    type GameSessionResult = {balances : [QueueEntry]; status : GameStatus};
    type GameStatus = {#Active; #Complete; #Nonexistent};
    type QueueEntry = {amount : Nat; player : Principal};
    type QueueValidation = {#Invalid; #ValidNotReady; #ValidReady};
    type TurnResult = {#InvalidMove; #NotYourTurn; #Ok}
  }

I import with import T "types";

the error looks like it’s aware of the Cell field in my types module.

Why can I not use this type?

1 Like

Can you show the offending line of code, with some context? I expect you may be trying to use the type field as a value (not a type) but can’t be sure without more info

ah I forgot to paste that too, thanks for looking.

 for (i in winningLines.keys()) {
        var line = winningLines[i];
        var foundTeam : T.Cell = T.Cell.Empty;
        var valid = true;
        let lineIter = Iter.range(0, line.size() - 1);

        label posCheck for (position in lineIter) {
          if (not valid) {
            break posCheck
          };
          let y = line[position][0];
          switch (board.get(y)) {
            case (?row) {
              switch (row.get(line[position][1])) {
                case (?cell) {
                  if (cell == T.Cell.Empty) { //this line here

where board is

    var board = M.HashMap<Nat, M.HashMap<Nat, T.Cell>>(10, Nat.equal, Hash.hash);
1 Like

Try replacing T.Cell.Empty with #Empty.

(T.Cell is a type, not a value you can access fields on.)