Javascript vs Typescript #680
Replies: 1 comment 1 reply
-
Hi @Jordan-Hataway, You're right that Obsidian uses TypeScript for its plugin development, which is indeed a super-set of JavaScript that adds static types and other features to the language. When TypeScript is compiled, it produces JavaScript code. This means that any TypeScript file, once compiled, becomes a plain JavaScript file that can be executed in environments like Obsidian. QuickAdd, although coded in TypeScript, operates in the same way. The compilation from TypeScript to JavaScript is a standard process which allows developers to leverage TypeScript’s advanced features like interfaces and type checking during development, while still producing JavaScript that is universally compatible with the JavaScript engine in Obsidian. Since TypeScript isn't directly executed but must first be compiled to JavaScript, it's practical for QuickAdd scripts to be written directly in JavaScript. This avoids the compilation step, simplifying the process for users who might not be familiar with TypeScript or do not want to set up a TypeScript compilation environment. If you're comfortable with TypeScript, you could indeed write your own scripts in TypeScript and compile them to JavaScript before using them with QuickAdd. This could give you the advantage of using TypeScript's features during development, but it requires an additional step of compilation. |
Beta Was this translation helpful? Give feedback.
-
In the Obsidian documentation listed here: https://docs.obsidian.md/Plugins/User+interface/Modals
...You can see that in the 'suggestion modal' section, an interface is implemented.
I'm new to obsidian and quickadd, but I am assuming that this means obsidian uses Typescript for its plugin environment. And I think Quickadd uses only Javascript files... This means that the full functionality of development in a quickadd script is limited, right? Maybe it's just not that big of a deal
I can make my script work without interfaces, but it really confused me for a while. Anybody know why Quickadd uses Javascript when Obsidian uses Typescript? I feel like they would ideally use the same language
Beta Was this translation helpful? Give feedback.
All reactions