Description
I am looking at mojo.js and exploring it as I look at a hobby project that needs something different from the content generators like Astro and Hugo that I've used in the past. So I am just starting to explore the tools documentation and capabilities. Right now I have the sample application generated by pnpm create @mojojs/full-app --ts
:
import mojo, {yamlConfigPlugin} from '@mojojs/core';
export const app = mojo();
app.plugin(yamlConfigPlugin);
app.secrets = app.config.secrets;
app.get('/').to('example#welcome');
app.start();
and my eslint configuration is complaining that this has some unsafe defaults.
6:1 error Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment
10:1 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises
✖ 2 problems (2 errors, 0 warnings)
The second one was trivial to solve, I set my "module" option in tsconfig to "ESNext" and then added an "await" before app.start(). I admittedly do not fully understand all the implications of that change on performance.
The first one though is more of a challenge. The right solution appears to be to explicitly type the const app
as something. vscodium and IntelJ IDEA. both infer that it is of type App
but while vscodium is simply unable to suggest a place to import that definition from, IntelJ suggests '@mojojs/core/lib/app'
except that does not appear to be a valid export.
Looking through the documentation I'm at a loss what the correct answer is. I strongly suspect this is a me problem and not a code problem, which is why I am requesting a paragraph or similar be added to the documentation to assist new adopters figure out things like this as they get themselves started.
Thanks!!