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:

    // 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();
    

Repository