D
Deno

help

types not inferred from npm packages

Llvin11/21/2022
im importing deepSignal an npm package with ts support however non of the returned types are inferred, i tested the same package in nodejs and it works there
import { effect } from "@preact/signals";
import { deepSignal } from "npm:@deepsignal/preact";
type UserNameStore = {
first: string;
last: string;
};

const getInitialUserNameStore = (): UserNameStore => {
const storedUserStore = localStorage.getItem("USER_NAME_STORE_KEY");
return storedUserStore
? JSON.parse(storedUserStore)
: { first: "", last: "" };
};

const userStore = deepSignal({
name: getInitialUserNameStore(),
email: "",
});

effect(() =>
localStorage.setItem(
"USER_NAME_STORE_KEY",
JSON.stringify(userStore.name.value)
)
);
import { effect } from "@preact/signals";
import { deepSignal } from "npm:@deepsignal/preact";
type UserNameStore = {
first: string;
last: string;
};

const getInitialUserNameStore = (): UserNameStore => {
const storedUserStore = localStorage.getItem("USER_NAME_STORE_KEY");
return storedUserStore
? JSON.parse(storedUserStore)
: { first: "", last: "" };
};

const userStore = deepSignal({
name: getInitialUserNameStore(),
email: "",
});

effect(() =>
localStorage.setItem(
"USER_NAME_STORE_KEY",
JSON.stringify(userStore.name.value)
)
);
UUUnknown User11/22/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!