TypeScript

To integrate the SDK into a game developed with TypeScript:

  1. Install npm by following the instructions on the Node.JS website.

  2. To include SDK types, install the @types/ysdk package:

    npm install --save @types/ysdk
    
  3. Import the required SDK module types into your project files. For example, you can import the ysdk and player types like this:

    1// Import necessary SDK module types.
    2import type { SDK, Player } from 'ysdk';
    3
    4...
    5
    6// Example of using the SDK with types.
    7const ysdk: SDK = await YaGames.init();
    8const player: Player = await ysdk.getPlayer();
    

Repository