How to use sealious app ORM methods in JDD

To avoid circular dependencies, use a dynamic import. To do so, change the toHTML function to async and set return type to Promise<Readable> (import Readable with import { Readable } from "stream";)

	async toHTML({
		title,
		content,
	}: ExtractStructuredComponentArgumentsValues<
		typeof component_arguments
	>): Promise<Readable> {

Then, within the function, you an get a handle to the the_app object with

const { the_app } = await import("../../index.js");

Make sure you’ve merged the latest changes from sealious-playground and ran npm install :+1:

error on that line: 
'the_app' is declared but its value is never read.ts(6133)
Property 'the_app' does not exist on type 'typeof import("/home/ziomek/Documents/sealcode/aspazja/src/back/index", { with: { "resolution-mode": "import" } })'.ts(23

error is gone when i change to
const { app } = await import("../../index.js");
but then, a new ts error emerge in src/back/app.ts

Subsequent property declarations must have the same type.  Property '$app' must be of type 'App', but here has type 'TheApp'.ts(2717)
index.d.ts(6, 9): '$app' was also declared here.

Just making sure - did you merge latest playground and ran npm install?

“merge latest playground” - merge playground to aspazja?

yep - I’ve just merged latest playground to master in aspazja to save you some trouble. Please merge it to your working branch and it should work :+1:

1 Like