Skip to content

Commit

Permalink
Add various type improvements (foundryvtt#13637)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmegaRogue committed Feb 14, 2024
1 parent 283051b commit f08ebb2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
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
23 changes: 19 additions & 4 deletions types/foundry/client/ui/filepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,27 @@ 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
* @param {string} target The target within the source location
* @param {Object} options Optional arguments which modify the request
* @return {Promise<Object>}
* @param source The source location in which to browse. See FilePicker#sources for details
* @param target The target within the source location
* @param options Optional arguments which modify the request
*/
static createDirectory(source: string, target: string, options: object): Promise<object>;

Expand Down

0 comments on commit f08ebb2

Please sign in to comment.