Typescript with vibe.d

Steven Schveighoffer schveiguy at gmail.com
Mon Mar 9 17:46:42 UTC 2020


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


More information about the Digitalmars-d-learn mailing list