Program Error: p.fn is not a function

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
codemeister69421
 
Posts: 2
Joined: Wed Sep 28, 2022 7:28 am

Program Error: p.fn is not a function

Post by codemeister69421 »

I'm getting "Program Error: p.fn is not a function" when I try to set the type of a variable to an interface.
The error pops up even before I run the program

it happens when I change

Code: Select all

let _currentState = null;
to

Code: Select all

let _currentState: ITimerState = null;
the interface looks like this

Code: Select all

interface ITimerState {
    onEnter: () => void;
    onUpdate: () => void;
    onButtonPress: () => void;
    onExit: () => void;
}
I want to do this because I want to call functions of classes that inherit ITimerState through _currentState.
This is my first time programming in JS so I don't know if I'm doing something wrong or if this is a JS thing

User avatar
codemeister69421
 
Posts: 2
Joined: Wed Sep 28, 2022 7:28 am

Re: Program Error: p.fn is not a function

Post by codemeister69421 »

I found what is causing the issue

calling _currentState in the forever seems to give issues.
There is however a update function i want to call from the forever, anyone ideas how i can call it?

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”