www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Typescript with vibe.d

reply GreatSam4sure <greatsam4sure gmail.com> writes:
I want to know if it is possible to use typescript with the 
vibe.d since typescript is a superset of javascript. I will 
appreciate any example if it is possible
Mar 09 2020
next sibling parent Panke <tobias pankrath.net> writes:
On Monday, 9 March 2020 at 09:42:16 UTC, GreatSam4sure wrote:
 I want to know if it is possible to use typescript with the 
 vibe.d since typescript is a superset of javascript. I will 
 appreciate any example if it is possible
What do you want to do?
Mar 09 2020
prev sibling next sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 3/9/20 5:42 AM, GreatSam4sure wrote:
 I want to know if it is possible to use typescript with the vibe.d since 
 typescript is a superset of javascript. I will appreciate any example if 
 it is possible
My understanding is that Typescript needs to be compiled to javascript. You can't serve typescript directly to a browser. So as long as you are doing this in a separate file, vibe.d can serve up the javascript files just fine. -Steve
Mar 09 2020
parent reply GreatSam4sure <greatsam4sure gmail.com> writes:
On Monday, 9 March 2020 at 15:11:48 UTC, Steven Schveighoffer 
wrote:
 On 3/9/20 5:42 AM, GreatSam4sure wrote:
 I want to know if it is possible to use typescript with the 
 vibe.d since typescript is a superset of javascript. I will 
 appreciate any example if it is possible
My understanding is that Typescript needs to be compiled to javascript. You can't serve typescript directly to a browser. So as long as you are doing this in a separate file, vibe.d can serve up the javascript files just fine. -Steve
I am working on a web app using a vibe.d but I prefer typescript to javascript. So I want to use typescript. My question is that can I use typescript instead of javascript since it must be compiled to javascript? Does the vibe.d framework compile typescript to javascript?
Mar 09 2020
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 3/9/20 1:23 PM, GreatSam4sure wrote:
 On Monday, 9 March 2020 at 15:11:48 UTC, Steven Schveighoffer wrote:
 On 3/9/20 5:42 AM, GreatSam4sure wrote:
 I want to know if it is possible to use typescript with the vibe.d 
 since typescript is a superset of javascript. I will appreciate any 
 example if it is possible
My understanding is that Typescript needs to be compiled to javascript. You can't serve typescript directly to a browser. So as long as you are doing this in a separate file, vibe.d can serve up the javascript files just fine. -Steve
I am working on a web app using a vibe.d but I prefer typescript to javascript. So I want to use typescript. My question is that can I use typescript instead of javascript since it must be compiled to javascript?
You can use it, but you have to compile it yourself. Vibe.d does nothing with the javascript except serve it to the browser. It has no restrictions on what files can be sent, but does not convert anything for you.
 Does the vibe.d framework compile typescript to javascript?
No. This means that if you wanted to use, for instance, a diet template to generate typescript, this would not work. My recommendation in that case is to generate javascript data using diet templates, and use it from a Typescript file that is pre-compiled before being served via vibe.d. -Steve
Mar 09 2020
parent GreatSam4sure <greatsam4sure gmail.com> writes:
On Monday, 9 March 2020 at 17:46:42 UTC, Steven Schveighoffer 
wrote:
 On 3/9/20 1:23 PM, GreatSam4sure wrote:
 [...]
You can use it, but you have to compile it yourself. Vibe.d does nothing with the javascript except serve it to the browser. It has no restrictions on what files can be sent, but does not convert anything for you.
 [...]
No. This means that if you wanted to use, for instance, a diet template to generate typescript, this would not work. My recommendation in that case is to generate javascript data using diet templates, and use it from a Typescript file that is pre-compiled before being served via vibe.d. -Steve
Thanks, that is what I want to know
Mar 09 2020
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On Monday, 9 March 2020 at 09:42:16 UTC, GreatSam4sure wrote:
 I want to know if it is possible to use typescript with the 
 vibe.d since typescript is a superset of javascript. I will 
 appreciate any example if it is possible
There's a Diet filter for TypeScript here [1], but it hasn't been updated since 2015. [1] https://code.dlang.org/packages/diet-typescript -- /Jacob Carlborg
Mar 10 2020
parent GreatSam4sure <greatsam4sure gmail.com> writes:
On Tuesday, 10 March 2020 at 08:55:56 UTC, Jacob Carlborg wrote:
 On Monday, 9 March 2020 at 09:42:16 UTC, GreatSam4sure wrote:
 I want to know if it is possible to use typescript with the 
 vibe.d since typescript is a superset of javascript. I will 
 appreciate any example if it is possible
There's a Diet filter for TypeScript here [1], but it hasn't been updated since 2015. [1] https://code.dlang.org/packages/diet-typescript -- /Jacob Carlborg
Thanks, it will be really nice to enable the use of typescript by default since it is type-safe. I will appreciate this feature of it can be added. I personally don't like dynamic languages due to lack of declaring a type for every variable
Mar 11 2020