So. This TypeScript thing has not been going as smoothly as I thought it would.
So yesterday, all ready to dig into the real meat of the changes I've been planning, I discovered that TypeScript is a good deal more derpy than I had thought. Despite taking the time to define the structure of the game's objects, it turns out that this was insufficient. In fact, intellisense wouldn't even work at the level of plain JS without any types at all.
So I discovered, that despite functions and objects all having types for input/out and all that, TypeScript will basically ignore it outside of that object's scope, making it far less useful. So it turns out that the type information also has to be defined in an interface. Oh, and while TypeScript loves object literals for the code, it hates them for interfaces. So... more work. Not too big a deal, frustrating, and would have taken half the time to do in the convoluted way from the start, but not a big deal. So I did that. And as I did, I caught a couple more mistakes in the code when types were actually checked between functions, so that was cool. So today I get back to where I thought I was yesterday, and go: "Let's compile this and make sure the output JS runs properly in SugarCube."
Nope! Won't run thanks to an "unexpected token <". Okay, fine, that happens, no big deal. Then I realize... there's almost no part of the JS/TS code I didn't prod in the last 24 hours. So there's an extra character somewhere in about 2.4 million characters of code. Hooray. Oh, and TypeScript compiles to JavaScript, so that extra < could be just about anywhere. So first I scroll through the remaining errors from TSLint. Nope, don't see anything related to an extra character on compile. Then I decide to lint all the compiled JS with ESLint, and if I find the character, I can just track backward over to the TypeScript to find the problem. Except, after opening what I'm pretty sure was every single JS file, I see... nada.
It's not the end of the world. There are more things to try. And of course, in the absolute worst case, I can always just nuke it from orbit (roll back to before typescript). But, that shouldn't be necessary. Anyways, after reaching that point, I decided it would be best to take a break before something gets broken, lol. It's about time for me to go to sleep, so I'll start again in the morning.
So that's it for now, wish me luck
o/
lol I wish you luck!!
ReplyDelete