Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taskCount() is not a function error #23

Closed
1Hanif1 opened this issue Apr 1, 2022 · 2 comments
Closed

taskCount() is not a function error #23

1Hanif1 opened this issue Apr 1, 2022 · 2 comments

Comments

@1Hanif1
Copy link

1Hanif1 commented Apr 1, 2022

truffle(development)> tl.taskCount()
evalmachine.<anonymous>:0
tl.taskCount()
   ^

Uncaught TypeError: tl.taskCount is not a function
    at evalmachine.<anonymous>
    at Script.runInContext (node:vm:139:12)
    at runScript (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:366:1)
    at Console.interpret (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:381:1)
    at bound (node:domain:421:15)
    at REPLServer.runBound [as eval] (node:domain:432:12)
    at REPLServer.onLine (node:repl:889:10)
    at REPLServer.emit (node:events:390:28)
    at REPLServer.emit (node:domain:475:12)
    at REPLServer.Interface._onLine (node:readline:487:10)
truffle(development)> tl.taskCount()
evalmachine.<anonymous>:0
tl.taskCount()
   ^

Uncaught TypeError: tl.taskCount is not a function
    at evalmachine.<anonymous>
    at Script.runInContext (node:vm:139:12)
    at runScript (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:366:1)
    at Console.interpret (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:381:1)
    at bound (node:domain:421:15)
    at REPLServer.runBound [as eval] (node:domain:432:12)
    at REPLServer.onLine (node:repl:889:10)
    at REPLServer.emit (node:events:390:28)
    at REPLServer.emit (node:domain:475:12)
    at REPLServer.Interface._onLine (node:readline:487:10)

I am able to access the tasks mapping but this is throwing an error and i can't figure out why

@1Hanif1
Copy link
Author

1Hanif1 commented Apr 1, 2022

"Member "taskCount" not found or not visible after argument-dependent lookup in contract TodoList"
again why is it showing this?

@1Hanif1
Copy link
Author

1Hanif1 commented Apr 1, 2022

Turns out I am stupid smh
uint256 public taskCount = 0;
forgot that the function to view a field value is provided by solidity ONLY if the field is public 🤦‍♂️

@1Hanif1 1Hanif1 closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant