TypeScript
To integrate the SDK into a game developed with TypeScript:
-
Install
npmby 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
ysdkandplayertypes 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();
Was the article helpful?
Previous
Next