Thread overview
Typescript with vibe.d
Mar 09, 2020
GreatSam4sure
Mar 09, 2020
Panke
Mar 09, 2020
GreatSam4sure
Mar 10, 2020
GreatSam4sure
Mar 10, 2020
Jacob Carlborg
Mar 11, 2020
GreatSam4sure
March 09, 2020
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
March 09, 2020
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?
March 09, 2020
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
March 09, 2020
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?
March 09, 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
March 10, 2020
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

March 10, 2020
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
March 11, 2020
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