pyzaist
pyzaist14mo ago

Standard setup of a monorepo that includes frontend and backend TypeScript code for one app

Hello friends, I'm new to Deno and have what I feel is a relatively simple use case, but I've struggled to find good guidance about it. My repo is here: https://github.com/timschwab/chesswar. Nothing too fancy, messing about with WebSockets and <canvas>. I used to have two repos - one for the backend server and one for the frontend server. But I decided to just join them into one repo, so I could trivially share some code and types between the server code and the client code. However this means that the VSCode workspace includes both Deno server code and frontend TypeScript, and so I don't know the right way to set target and lib. Does this make sense? Any help appreciated. Thanks!
1 Reply
pyzaist
pyzaist14mo ago
examples - if i do
{"compilerOptions": {}
{"compilerOptions": {}
then document.getElementById(id) gives me Cannot find name 'document'. if i do
{"compilerOptions": {"lib": ["dom"]}}
{"compilerOptions": {"lib": ["dom"]}}
then Object.fromEntries gives me Cannot find name "Object" and note that i am using esbuild to actual package up the client code into a JS bundle so this is only to get rid of the vs code errors i think and i did see this: https://deno.com/manual@v1.33.1/advanced/typescript/configuration#using-the-lib-property but i am not certain this answers precisely my question hmm possibly { "lib": ["dom", "deno.ns", "deno.unstable"] } worked this is fine i guess, but doesnt really get at the problem the problem is that two different sets of libs should be used in the two areas: browser code and deno code so ideally i could setup vs code to do that. is this possible?