Question:
I have my Sequelize models set up and working. Here’s a simplified example how how I’ve done it:Thing
data type throughout my app on both the front-end and back-end so that I get nice TypeScript support in VS Code for the properties available on my class
.But when I do this in my front-end code (which happens to be Svelte) I get a type error:
Thing
class throughout my front and back-end JS?Answer:
Sequelize wants access to the database (via NodeJS api's) and is not available in the Frontend.A type import:
import type { Thing } from "$lib/db";
should be allowed,
this statement is removed after typescript compilation.But is it only for type checking, and because real class can't be used it's not very useful.
If you have better answer, please add a comment about this, thank you!