Jump to content
RAGE Multiplayer Community

How to use Typscript on client-side?


Recommended Posts

@pandov I hope you know what kind of language TypeScript (TS) is and what it is used to be. If not:
TS is a static and object oriented language which is build upon the Javascript-Syntax - means that JS-Syntax and -code is all valid to TS.

Now, to use TS you will need a TS-compiler, which literally does just parsing TS-code and converts it to JS-Code. Thus, the answer is that you will need the TS compiler. The TS compiler can then be used with the "tsc" command, if installed.

Though, configuring a TS project - yes, you will have to configure things like the entry file, excluded and included libs and so on - can be confusing at first. Furthermore, you should configure packaging of files with a packer like browserify or webpack. I would recommend it but actually it is optional.

Nevertheless, and this is important to say, TS will, for web- and RageMP client-side development, always need a compiler which converts TS-code into JS-code, which later then can be used as "the script".

But hey, I think you are doing well if you want to use TS, since the written code is more clear than JS to write.

Hope this helps.

Link to comment
Share on other sites


But after all here it is told how to include support for the Typescript language in the development environment VSCode. But I use fulled Visual Studio Enterprise.
But I want to enable language support when I develop. I don't need syntax hints. I want to start writing code on Typescript. How can I do this (enable support)? Or it is enabled by default?

Link to comment
Share on other sites

@pandov I thought you've meant vscode - how could I know you meant VS? You didn't wrote VS. So I helped you with a VSC-link.

On Visual Studio, things work different. There you have to use the Visual Studio Installer where you can install TypeScript or you use the first parts of the tutorial I've sent and use the command line. Since the npm TS package is both the linter and the compiler, you get both by installing that package (globally).

Syntax hints are a part of a language support in general. Again, VS supports writing TS. But as far as I know, the version of TS used in VS was some older version when I last used it.

Go ahead and use VS, but I strongly recommend using VSC, since TS is (I think) an inbuild feature of VSC. The language support you get with VSC is definetely sufficient.

Edited by TheMysteriousVincent
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...