If I want to Customize or hack the tiddlywiki can I learn typescript?

At first I want to edit the tiddler in neovim when edit event occurred. So I do some google work about how to make it.
At last I know that I need to learn js. But I know typescript too, which seems a better js? (maybe I am wrong). But it is said that the typescript is eaiser to learn. I like easy things.

So my question is can I use typescript to help me hack the tw. I use python for several years but haven’t use js before.

TypeScript needs to be “compiled” to regular JavaScript, so it’s not a good fit for using with TW.

TS isn’t easier, but it does have types which can help in finding errors in your code. Using “plain” JS is going to be easier to get started with TW.

Thank you I will learn js first.

2 Likes

If it helps i was reading about this recently and understand typescripts main function was to add stricter type definitions than native javascript. I know neither but i expect learning one will go a long way to learning the other. Although I am sure other deferences have emerged.

That’s largely received wisdom, I think. You’d be hard pressed to show statistical evidence or studies supporting that statement. Seriously, I know a man that tried

Needless to say, those posts started a kind of “types wars” in the comments – best to alot an hour of your time if you really want the down and dirty on types.

3 Likes

We use it at work. We have a background in functional programming. We coordinate types across interfaces and programming languages. Types in ts catch certain classes of bugs.

Writing javascript for the Tiddlywiki environment (browser or wiki) is not quite like most other “javascript tutorials” on the web. Most of those other tutorials show you how to directly manipulate the DOM (“Document Object Model”), or use raw “javascript events”. This will be good to know when you get to customizing TiddlyWiki, but you have to approach it from a different “direction”. You cannot manipulate the DOM directly, because the next TidldyWiki refresh will destroy what you have done, instead you manipulate the objects held under the $tw and $tw.wiki objects, and those updates are automatically translated into onscreen updates through the TW DOM methods.

I can offer advice when you get to that point.

Best,
Joshua Fontany

Best,

3 Likes