Remix.run Logo
jmull a day ago

You could use jsdoc, or 'tsc' your .ts files on the way to loading them into the db.

Typescript has a fairly limited utility here though. It's a static type checker. Your types are mostly going to be SQL parameters and the result of running SQL, which, by design/nature are resolved at runtime. You could build a bunch of external controls to help ensure the runtime data is contained to your static types, but you're really swimming upstream. Like you can use a screwdriver as a hammer, but there are better approaches. (I think typescript would be much better used client-side, in your app server code that is above the data layer.)

90s_dev a day ago | parent [-]

I tried jsdoc for so many years before just giving up and going full TypeScript.

But you're right, the TS layer would be static, and you would compile to JS and just use that... I guess.

Until the types-proposal is inevitably implemented, of course.