Skip to main content

TypeScript Type Support

TypeScript Type Support

In TypeScript projects, you can install the tudada-sdk-types npm package to enable type autocompletion.

Installation

npm install tudada-sdk-types --save-dev

Usage

import type { LoginOption, SystemInfo, RewardedVideoAd } from 'tudada-sdk-types';

// Automatic type support for global variables
TudadaSDK.login({
success: (res) => {
// res type is automatically inferred
console.log('Code:', res.code);
console.log('User ID:', res.userId);
},
});

const info: SystemInfo = TudadaSDK.getSystemInfoSync();

Note: Make sure the version of tudada-sdk-types matches the SDK version you are using. If the versions differ, the type definitions may not match the actual API behavior.