Data Space
This document describes the data space feature of the GameDataStorage API, detailing its optimization background and usage examples.
API Documentation: GameDataStorage
Optimization Background
Reason for Modification
In the original d.ts file provided by the officials, the value field of the GameDataStorage API interface was uniformly declared as the any type (more specifically, the official custom JSONValue type, which can accommodate strings, numbers, booleans, objects, and arrays).
To ensure type consistency within the data space, we have introduced generic constraints. This optimization significantly improves code readability and the accuracy of type checking.
Usage Examples
Default Usage (Without Generics)
By default, the value field is of type JSONValue:

Usage with Generic Constraints
After adding generic constraints, the type of the value field becomes more specific:
