Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion docs/english/reference/web-api/classes/Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3063,7 +3063,10 @@ Use `uploadV2` instead. See [our post on retiring \`files.upload\`](https://docs
#### uploadV2

```ts
uploadV2: MethodWithRequiredArgument<FilesUploadV2Arguments, WebAPICallResult>;
uploadV2: MethodWithRequiredArgument<
FilesUploadV2Arguments,
WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] }
>;
```

##### Description
Expand Down
5 changes: 4 additions & 1 deletion docs/english/reference/web-api/classes/WebClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,10 @@ Use `uploadV2` instead. See [our post on retiring \`files.upload\`](https://docs
#### uploadV2

```ts
uploadV2: MethodWithRequiredArgument<FilesUploadV2Arguments, WebAPICallResult>;
uploadV2: MethodWithRequiredArgument<
FilesUploadV2Arguments,
WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] }
>;
```

##### Description
Expand Down
9 changes: 7 additions & 2 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,9 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
}

public abstract apiCall(method: string, options?: Record<string, unknown>): Promise<WebAPICallResult>;
public abstract filesUploadV2(options: FilesUploadV2Arguments): Promise<WebAPICallResult>;
public abstract filesUploadV2(
options: FilesUploadV2Arguments,
): Promise<WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] }>;

public readonly admin = {
analytics: {
Expand Down Expand Up @@ -1928,7 +1930,10 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
* as multiple file uploads property.
* @see {@link https://docs.slack.dev/tools/node-slack-sdk/web-api/#upload-a-file `@slack/web-api` Upload a file documentation}.
*/
uploadV2: bindFilesUploadV2<FilesUploadV2Arguments, WebAPICallResult>(this),
uploadV2: bindFilesUploadV2<
FilesUploadV2Arguments,
WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] }
>(this),
comments: {
/**
* @description Deletes an existing comment on a file.
Expand Down
5 changes: 5 additions & 0 deletions packages/web-api/test/types/methods/files.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { expectAssignable, expectError } from 'tsd';
import { WebClient } from '../../../src/WebClient';
import type { WebAPICallResult } from '../../../src/WebClient';
import type { FilesCompleteUploadExternalResponse } from '../../../src/types/response/FilesCompleteUploadExternalResponse';

const web = new WebClient('TOKEN');

Expand Down Expand Up @@ -177,6 +179,9 @@ expectAssignable<Parameters<typeof web.files.uploadV2>>([
content: 'text',
},
]);
expectAssignable<Promise<WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] }>>(
web.files.uploadV2({ content: 'text' }),
);

// files.comments.delete
// -- sad path
Expand Down