Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code to make it TS 4.4 compatible #1319

Merged
merged 1 commit into from Aug 27, 2021
Merged

Conversation

seratch
Copy link
Member

@seratch seratch commented Aug 26, 2021

Summary

This pull request fixes the compilation failures with the latest TypeScript compiler (v4.4.x)

Requirements (place an x in each [ ])

@seratch seratch added area:typescript issues that specifically impact using the package from typescript projects pkg:rtm-api applies to `@slack/rtm-api` labels Aug 26, 2021
@seratch seratch added this to the rtm-api@6.x milestone Aug 26, 2021
@seratch seratch requested a review from srajiang August 26, 2021 22:54
@seratch seratch modified the milestones: rtm-api@6.x, rtm-api@6.1 Aug 26, 2021
@seratch seratch changed the title Update rtm-api package code to make it TS 4.4 compatible Update code to make it TS 4.4 compatible Aug 26, 2021
@seratch seratch removed this from the rtm-api@6.1 milestone Aug 27, 2021
@seratch seratch added pkg:oauth applies to `@slack/oauth-helper` pkg:socket-mode applies to `@slack/socket-mode` pkg:web-api applies to `@slack/web-api` pkg:webhook applies to `@slack/webhook` labels Aug 27, 2021
@seratch
Copy link
Member Author

seratch commented Aug 27, 2021

Okay, now all the errors are settled. We'd like to merge this as early as possible to smoothly accept contributions.

Copy link
Member Author

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments for reviewers

@@ -39,7 +39,7 @@
},
"dependencies": {
"@slack/logger": "^3.0.0",
"@slack/web-api": "^6.0.0",
"@slack/web-api": "^6.3.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has not been safe enough. oauth.v2.access API argments in the code are compatible only with 6.3+

@@ -191,7 +191,7 @@ export class InstallProvider {
}

return authResult;
} catch (error) {
} catch (error: any) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As either any or unknown is allowed for the type, we are unable to use more specific types here. If we want to do so, we have to cast the type from unknown inside the catch clause.

this.logger.warn('http request failed', error.message);
if (error.request) {
throw requestErrorWithOriginal(error);
// To make this compatible with tsd, casting here instead of `catch (error: any)`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We run tsd type tests only for web-api package as of today

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bumping up compatibility to TS 4.4!

@seratch
Copy link
Member Author

seratch commented Aug 27, 2021

Thanks for the review! Let me merge this not to block the following contributions! If we find better ways to change the code, we can update at any time!

@seratch seratch merged commit 28ef045 into slackapi:main Aug 27, 2021
@seratch seratch deleted the ts-4.4 branch August 27, 2021 03:48
@hello-ashleyintech hello-ashleyintech added this to the rtm-api@6.1.0 milestone Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typescript issues that specifically impact using the package from typescript projects pkg:oauth applies to `@slack/oauth-helper` pkg:rtm-api applies to `@slack/rtm-api` pkg:socket-mode applies to `@slack/socket-mode` pkg:web-api applies to `@slack/web-api` pkg:webhook applies to `@slack/webhook`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants