SolidJSS
SolidJSโ€ข2y agoโ€ข
3 replies
BasicBit | Alex

Use `createEffect` in a terminal environment with Deno and TypeScript

Hello everyone!

I wrote the following code, but the effect doesn't work. Nothing is shown in the console:
import { createEffect } from "npm:solid-js";
import { createMutable } from "npm:solid-js/store";

const state = createMutable({ count: 0 });

createEffect(() => {
    console.log(state.count);
});

setInterval(() => state.count++, 1000);


But if I use Skypack imports it works:
import { createEffect } from "https://cdn.skypack.dev/solid-js";
import { createMutable } from "https://cdn.skypack.dev/solid-js/store";

// ...


But Skypack doesn't provide the TypeScript types. So everything is any and I get the JavaScript experience.

Does anyone smarter than me have an idea how to fix this?

Thanks for any help! ๐Ÿ˜„
Was this page helpful?