Cannot read properties of undefined reading (reading 'chachedIR')

i have a function:

function makePlayer(img: Image, id: number, walkSpeed: number, jumpHeight: number, init: (plr: Player) => void): Player {
    let plr = {
                sprite: sprites.create(img, SpriteKind.Player),
                id: id,
                _walkSpeed: walkSpeed,
                _jumpHeight: jumpHeight,

                get jumpHeight(): number {
                    return plr._jumpHeight;
                },

                set jumpHeight(val: number) {
                    plr._jumpHeight = val;
                },

                get walkSpeed(): number {
                    return plr._walkSpeed;
                },

                set walkSpeed(val: number) {
                    plr._walkSpeed = val;
                    controller.moveSprite(plr.sprite, plr._walkSpeed, 0);
                },

                initialize: function (): void {
                    plr.sprite.ay = 350;
                    plr.walkSpeed = walkSpeed;
                    plr.jumpHeight = jumpHeight;

                    init(plr);
                },

                grounded: function (): boolean {
                    return plr.sprite.vy == 0;
                },

                jump: function (): void {
                    if (!plr.grounded()) return;
                    plr.sprite.vy -= plr.jumpHeight;
                },

                cameraFollow: function (): void {
                    scene.cameraFollowSprite(plr.sprite);
                }
    }
    
    return plr;
}

BRUH I DONT EVEN HAVE THE GOOFY BRUH CHACHED IR ANYWHERE IN MA CODEEEEE :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob:

Sorry, could you post the full code (or project link, that would be easier) since it seems your code is accessing the Player class which is not present here, and I would need some more context to solve this issue

solution: dont use object literals, use classes. makecode just doesnt like it