I came up with a silly one liner partial workaround. Use:
MySprite = class('MySprite').extends(playdate.graphics.sprite) or MySprite
Instead of:
class('MySprite').extends(playdate.graphics.sprite)
The latter operates implicitly by injecting A
into the global namespace.
The former includes an explicit global assignment.
It's an awkward no-op, but it's enough for static analysis tools to keep track of where MySprite gets created.
Relatedly, I improved playdate-luacats
to have proper type annotations for the APIs provided by object.lua. See: notpeter/playdate-luacats - v2.1.0-luacats7.