-
-
Notifications
You must be signed in to change notification settings - Fork 17
Description
I'm trying to create a convenience wrapper function for myself to use q5 in a way that suits me better than the default. This wrapper has been previously made for and functioned with p5. The details of the wrapper needn't matter too much, the point is that it requires the use of instance mode.
Current functional minimal functional code using instance mode works is as follows. The setup
and draw
functions are supplied to the wrapper, q
is used as a frontend for q5 (as is officially documented).
let q: Q5 = new Q5("instance");
q.setup = () => {
setup(q);
};
q.draw = () => {
draw(q);
};
This code works and runs without errors. The problem is that the in-editor type validation does not work, as the Q5
type does not actually contain most of q5's functions. Those functions are only declared in types under a global scope. I tried various workarounds to import the global scope of types into a custom named type, but nothing I tried worked for that.
Would it be possible to have a type that includes all the functions and constants of Q5, instead of only having them in the global scope? Or is it somehow possible to import the types from under declare global
in q5.d.ts
as a single type?