Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add various type improvements #13637

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions types/foundry/client/apps/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,11 @@ declare class Localization {
* game.i18n.format("MY_TEST_STRING", {name: "Andrew"}); // Produces "Your name is Andrew"
*/
format(stringId: string, data?: { [key: string]: string | number | boolean | null }): string;

/**
* Return whether a certain string has a known translation defined.
* @param stringId The string key being translated
* @param fallback
*/
has(stringId: string, fallback?: boolean): boolean;
}
2 changes: 2 additions & 0 deletions types/foundry/client/game.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ declare global {
/** The global document index. */
documentIndex: DocumentIndex;

documentTypes: Record<string, string[]>;

/** Whether the Game is running in debug mode */
debug: boolean;

Expand Down
16 changes: 16 additions & 0 deletions types/foundry/client/ui/filepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ declare class FilePicker extends Application<FilePickerOptions> {
*/
static upload(source: string, path: string, file: File, options: object): Promise<boolean>;

/**
* A convenience function that uploads a file to a given package's persistent /storage/ directory
* @param packageId The id of the package to which the file should be uploaded. Only supports Systems and Modules.
* @param path The relative path in the package's storage directory the file should be uploaded to
* @param file The File object to upload
* @param body
* @param options Additional options to configure how the method behaves
*/
static uploadPersistent(
packageId: string,
path: string,
file: File,
body?: object,
options?: { notify?: boolean },
): Promise<boolean>;

/**
* Create a subdirectory within a given source. The requested subdirectory path must not already exist.
* @param {string} source The source location in which to browse. See FilePicker#sources for details
stwlam marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading