TypeScript
To integrate the SDK into a game developed with TypeScript:
-
Install
npm
by following the instructions on the Node.JS website. -
To include SDK types, install the @types/ysdk package:
npm install --save @types/ysdk
-
Import the required SDK module types into your project files. For example, you can import the
ysdk
andplayer
types like this:// Import necessary SDK module types. import type { SDK, Player } from 'ysdk'; ... // Example of using the SDK with types. const ysdk: SDK = await YaGames.init(); const player: Player = await ysdk.getPlayer();