-
Notifications
You must be signed in to change notification settings - Fork 852
text type hint in LinkButtonElement does not accept PlainTextObject/dict #1178
Copy link
Copy link
Closed
Labels
Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client
Milestone
Description
Reproducible in:
The following code results in a type checking error (using mypy for type checking)
LinkButtonElement(
text=PlainTextObject(
text="text
),
url="http://slack.com",
)main.py:551: error: Argument "text" to "LinkButtonElement" has incompatible type "PlainTextObject"; expected "str"
From what I understand, a PlainTextObject is appropriate for this element? https://api.slack.com/reference/block-kit/block-elements#button__examples
Could you please confirm whether 1 & 2 below are both valid
1.
LinkButtonElement(
text=PlainTextObject(
text="text
),
url="http://slack.com",
) LinkButtonElement(
text="text"
url="http://slack.com",
)The Slack SDK version
slack-sdk==3.14.1
Python runtime version
Python 3.9.6
OS info
ProductName: macOS
ProductVersion: 12.2
BuildVersion: 21D49
Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
Steps to reproduce:
- Create a LinkButtonBlock with a PlainTextObject element
- run mypy on your code
Expected result:
I expect to see no error from mypy
Actual result:
main.py:551: error: Argument "text" to "LinkButtonElement" has incompatible type "PlainTextObject"; expected "str"
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client