# Developer Guide: Improving TypeScript Declaration Files

This project uses TypeScript declaration files (`.d.ts`) to provide type information for its JavaScript code. These files are essential for developer tools, enabling features like autocompletion, IntelliSense, and static type checking.

While parts of these files are generated automatically, they also contain **manual adjustments** to correctly type parts of the library that couldn't be automatically inferred.

---

### ⚠️ IMPORTANT: Do Not Just Regenerate This File ⚠️

The declaration file, specifically `citra.d.ts`, contains crucial manual fixes for custom logic and third-party libraries (e.g., `chakram`). **Directly regenerating this file will overwrite these manual adjustments and may break the typings.** This can lead to a loss of essential type information and unexpected errors throughout the project.

---

### Contribution Workflow

If you need to update or improve the type definitions, follow this specific workflow to preserve existing manual changes:

1.  **Backup the File**: Before regenerating, create a copy of the current `citra.d.ts` file and rename it to something like `citra.d.ts.bak`. This backup will contain all the necessary manual adjustments.
2.  **Regenerate**: Run your type generation tool. This will create a new `citra.d.ts` file with the latest auto-generated types.
3.  **Merge Changes**: Manually compare the new `citra.d.ts` with your `citra.d.ts.bak`. Carefully copy the manual adjustments from your backup into the newly generated file. This process ensures you get the new auto-generated types while keeping the custom fixes.
4.  **Remove Backup**: Once you have merged the changes and verified that everything works correctly, delete the backup file.

---

### Known Areas for Improvement

Here are some specific parts of the declaration file that may require attention:

* **`ChakramRequestOptions` Interface**: The `ChakramRequestOptions` interface is not fully defined. It needs to be manually completed with all relevant properties to correctly type the request functions.