Skip to content

Commit

Permalink
[google-apps-script]File.getDescription() may return null. (Definitel…
Browse files Browse the repository at this point in the history
…yTyped#49007)

File description's initial value is null.
  • Loading branch information
mahaker authored Nov 24, 2020
1 parent 7583bce commit ed6569c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions types/google-apps-script/google-apps-script-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,14 @@ function onChange(e: GoogleAppsScript.Events.SheetsOnChange) {
console.log('Formatting change detected');
}
}

const createFileAndGetDescription = () => {
// Create file.
const file = DriveApp.createFile('New Text File', 'Hello, world!');
// Get description. Expect null.
Logger.log(file.getDescription());
// Set description.
file.setDescription('desc');
// Get description. Expect 'DESC'.
Logger.log(file.getDescription().toUpperCase());
};
2 changes: 1 addition & 1 deletion types/google-apps-script/google-apps-script.drive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ declare namespace GoogleAppsScript {
getAs(contentType: string): Base.Blob;
getBlob(): Base.Blob;
getDateCreated(): Base.Date;
getDescription(): string;
getDescription(): string | null;
getDownloadUrl(): string;
getEditors(): User[];
getId(): string;
Expand Down

0 comments on commit ed6569c

Please sign in to comment.