Menu

FiveM x TypeScript
🖼️

FiveM x TypeScript

DEV Community·Justin Martin·6 months ago
#Il1zQtHd
Reading 0:00
15s threshold

FiveM is a modification for Grand Theft Auto V enabling you to play multiplayer on customized dedicated servers, powered by Cfx.re.

When you develop a FiveM server, you can create resource . Theses resources can be write in multiple langage Lua , C# and JavaScript . In this article we are going to see how to build a resource using TypeScript

Type :

For typing our code, we will use two packages provided by CFX.re the company behind FiveM

@citizenfx/client

@citizenfx/server

These packages provided types for each native method usable inside client-side or server-side code.

tsconfig.json

{ "compilerOptions" : { "target" : "ES2020" , "module" : "ESNext" , "moduleResolution" : "Bundler" , // Location "outDir" : "./dist" , // Other "types" : [ "@citizenfx/client" , "@types/node" ], "lib" : [ "ES2020" ], "strict" : true , "esModuleInterop" : true , "allowSyntheticDefaultImports" : true , "skipLibCheck" : true }, "include" : [ "src/**/*.ts" ], "exclude" : [ "**/node_modules" , "**/.test.ts" ] }

Enter…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.