Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2018-05-01 23:42:35

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Where are the TypeScript libraries?

So obviously there are a couple of JS libraries for writing bots, but why no love for TypeScript? :c
It has the best of both worlds: web-based applications (although requires a transpiler for now) && type safety && more OOP-like syntax (like C#/Java/etc).

And while you're at it you might just as well upload it to NPM for easy integration.


Now obviously I could just make it myself, but I don't feel like translating existing packages over to TypeScript and I don't have any library ideas myself right now.
That being said, if people WOULD have certain explicit library suggestions, feel free to post some. I'm not planning on recreating EEPhysics or the entirety of BotBits, however (smaller parts of BotBits would be fine).

#SpreadTheLoveForTypeScript

P.S. (for hardcore web developers) Yes, stuff like Facebook's Flow also exist, I just prefer TypeScript for reasons that are outside the scope of this topic (I think).

Offline

Wooted by: (2)

#2 2018-05-02 00:38:50

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: Where are the TypeScript libraries?

I guess IMO I like programming languages to reflect whats actually happening inside the computer, so I dont really like the feeling of languages with types that dont actually end up having types, although I cant really say much about it because I havent used it other than briefly just to try it out.

Plus until things like webassembly become a thing, you won't see any of the performance advantages of static typing as its all just converted back to javascript anyway.

Also you can use pure javascript with typescript cant you? Or does it actually require types to be included in the source?

Offline

#3 2018-05-02 13:40:28

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Where are the TypeScript libraries?

LukeM wrote:

I guess IMO I like programming languages to reflect whats actually happening inside the computer, so I dont really like the feeling of languages with types that dont actually end up having types, although I cant really say much about it because I havent used it other than briefly just to try it out.

Plus until things like webassembly become a thing, you won't see any of the performance advantages of static typing as its all just converted back to javascript anyway.

Also you can use pure javascript with typescript cant you? Or does it actually require types to be included in the source?

TypeScript isn't a language you actually run, it's transpiled in ES5 (JavaScript).
Same thing as frameworks like React, where you write in ES6 (JavaScript), but since ES6 is not yet supported by browsers, you transpile it back to ES5. Allowing you to have all the neat standards and features from ES6, while still making code that runs everywhere.

For example, an interface you would write in TypeScript, is simply nowhere to be found when it's transpiled in ES5. It doesn't exist in there, so it is solely in your source code to help you program without introducing any bugs, like you easily can in JavaScript.

Offline

#4 2018-05-02 15:17:35, last edited by LukeM (2018-05-02 15:23:19)

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: Where are the TypeScript libraries?

den3107 wrote:
LukeM wrote:

TypeScript isn't a language you actually run, it's transpiled in ES5 (JavaScript).
Same thing as frameworks like React, where you write in ES6 (JavaScript), but since ES6 is not yet supported by browsers, you transpile it back to ES5. Allowing you to have all the neat standards and features from ES6, while still making code that runs everywhere.

For example, an interface you would write in TypeScript, is simply nowhere to be found when it's transpiled in ES5. It doesn't exist in there, so it is solely in your source code to help you program without introducing any bugs, like you easily can in JavaScript.

ik, thats what I mean by it not reflecting whats actually happening inside the computer. The types dont make any functional difference, and sometimes even limit what you can do (making code longer and occasionally messier), and certain features that may be efficient in ES6 may be much slower in ES5, which may occasionally cause problems with larger projects where time is important.

Plus I dont think I've ever experienced the problems with types that TypeScript is supposed to prevent (I guess probably because its just me that writes the code, so I know what everything does), so I might as well just use pure JS

Edit: Just tried to convert part of my libs code to TypeScript, and it doesn't seem like you can (easily) use JS libs from TS? If you cant, is it even possible to use PlayerIO from typescript?

Offline

#5 2018-05-03 00:00:05, last edited by den3107 (2018-05-03 00:00:49)

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Where are the TypeScript libraries?

LukeM wrote:
den3107 wrote:

ik, thats what I mean by it not reflecting whats actually happening inside the computer. The types dont make any functional difference, and sometimes even limit what you can do (making code longer and occasionally messier), and certain features that may be efficient in ES6 may be much slower in ES5, which may occasionally cause problems with larger projects where time is important.

Plus I dont think I've ever experienced the problems with types that TypeScript is supposed to prevent (I guess probably because its just me that writes the code, so I know what everything does), so I might as well just use pure JS

Obviously this comes down to a personal preference. TypeScript isn't really slower if you use the same forms of optimization, however there are several things that quite bloat the transpiled code (like inheritance).
I personally just can't comfortably program without type safety. It provides senseful auto completion and brings a whole lot more structure to your code (in my opinion).
Aside from that, you actually CAN program "typeless" in TypeScript using the "any" type (take a guess what it means). So if you find places where you indeed have to write excessive amounts of code to "bypass" it being typed: there's your fix. I actually use it plenty, mostly when dealing with API's and such.

LukeM wrote:

Edit: Just tried to convert part of my libs code to TypeScript, and it doesn't seem like you can (easily) use JS libs from TS? If you cant, is it even possible to use PlayerIO from typescript?

This is a simple fix if you mix TypeScript with JavaScript files (configuration).
This is a little weirder fix if you're using external JavaScript libraries (where TypeScript complains it can't find the objects and such)


If people actually want to use TypeScript, I could always write some type files and put it on NPM for usage. But I'm not going to make it if nobody's going to use it (duh).

Offline

Wooted by:
den31071525302005704950

Board footer

Powered by FluxBB

[ Started around 1713519688.3391 - Generated in 0.058 seconds, 12 queries executed - Memory usage: 1.43 MiB (Peak: 1.55 MiB) ]