Typescript and Shotguns
TLDR: FML
2 min readFeb 8, 2022
3 days. I spent 3 days debugging a fucking typescript project I pulled from github. For some basic shit.
If you really depressed or something, call these folks. Life is worth living m8.
Day 1
- Pulled github repo. Installed npm modules on client and server. Client works. Great. Now to work on server.
- Server seems to compile fine locally. Put files on server.
- Run npm build on server. Nothing. Script doesn’t work.
- Can’t access node. Lovely. npm runs from a local env, but node is installed in the root folder, and I can’t access it. wtf is this?
- How do I get the build folder in the terminal? Also, how do I install packages?
- Got it. I need to put the package.json file in the root folder. Initially, the scripts file wasn’t running because I couldn’t cd into the src file to run the server.js file. Fixed that.
- Server seems to be up and running. Some basic database error of not connecting to the database. Alright. Will take care of it tomorrow.
Day 2
- That database error isn’t solving itself. Create tables. Not working.
- Change credentials and database name and permissions. Not working.
- Checking error. Database isn’t running on local, but error is same. Error probably because of path stuff then.
- Don’t know how to check if online database is running.
- Keep changing different parameters and create multiple starter projects to understand what parameters will work for a basic typescript app.
- Nothing works. wtf.
- Do some magic, get a different error. Wait what?
- Google error. Apparently, it’s a versioning error.
- Screw around with different versions. Keep trying different combinations of tsconfig.json and package.json. Nothing works.
- Possibly some basic thing. Will check tomorrow. Read a bit about typescript and check the codebase.
Day 3
- Finally get local db up and running. Connect it to backend. Realise that it isn’t a db error that’s been screwing me.
- Almost become inspired by Kurt Cobain.
- Eyes slowly dying. Ask server person for help. Server person on gmeet. Suddenly, import error. Never seen before.
- wtf. Sit there for 30 minutes trying to fix. Apologise to server person for wasting his time. He tells good stories.
- Become inspired. Decide to keep solving problem.
- Have 30+ tabs open at one point. Laptop on the verge of filing a police complaint.
- Have a breakthrough. Discard all changes, go back to initial file.
- Change a few paths.
- Works.
- Look up. See Typescript creator laughing at me. Shotgun next to me. Thinking about firing.
- Remember Buddha. For a moment, have achieved Moksha. Scream into pillow “I DID IT”.
- Collapse from exhaustion. Happy, but exhausted.
- Life is good.
Sidenote: Haven’t written for some time. Lifestyle changes and mental health. Back now. Again.
Listen to USSR anthem and be happy.