Skip to content

Commit 16a43ca

Browse files
authored
fix(web-api): add channel_id to canvases.create method (#2505)
1 parent f1fb7bf commit 16a43ca

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

.changeset/three-turtles-battle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@slack/web-api": patch
3+
---
4+
5+
fix(web-api): add channel_id to canvases.create method

packages/web-api/src/types/request/canvas.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ export interface CanvasesAccessSetArguments extends CanvasID, Partial<ChannelIDs
6565

6666
// https://docs.slack.dev/reference/methods/canvases.create
6767
export type CanvasesCreateArguments = OptionalArgument<
68-
TokenOverridable & {
69-
/** @description Title of the newly created canvas. */
70-
title?: string;
71-
/** @description Structure describing the type and contents of the Canvas being created. */
72-
document_content?: DocumentContent;
73-
}
68+
TokenOverridable &
69+
Partial<ChannelID> & {
70+
/** @description Title of the newly created canvas. */
71+
title?: string;
72+
/** @description Structure describing the type and contents of the Canvas being created. */
73+
document_content?: DocumentContent;
74+
}
7475
>;
7576

7677
// https://docs.slack.dev/reference/methods/canvases.sections.lookup

packages/web-api/test/types/methods/canvas.test-d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ expectError(
5151
// -- happy path
5252
expectAssignable<Parameters<typeof web.canvases.create>>([]); // no arg ok
5353
expectAssignable<Parameters<typeof web.canvases.create>>([{}]); // all optional args
54+
expectAssignable<Parameters<typeof web.canvases.create>>([{ title: 'My canvas' }]); // with title
55+
expectAssignable<Parameters<typeof web.canvases.create>>([
56+
{
57+
document_content: {
58+
type: 'markdown',
59+
markdown: '# Hello', // with document_content
60+
},
61+
},
62+
]);
63+
expectAssignable<Parameters<typeof web.canvases.create>>([
64+
{
65+
channel_id: 'C1234', // with channel_id
66+
},
67+
]);
5468

5569
// canvases.sections.lookup
5670
// -- sad path

0 commit comments

Comments
 (0)