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

Make various typechecking improvements #505

Merged
merged 2 commits into from
Sep 30, 2022
Merged

Make various typechecking improvements #505

merged 2 commits into from
Sep 30, 2022

Conversation

AndrewFerr
Copy link
Member

Some type-checking improvements that make parts of the code more expressive & easier to work with.

Note that this is based on the config widget PR because it is the source of one of the type annotations added by this PR.

@AndrewFerr AndrewFerr self-assigned this Sep 30, 2022
@AndrewFerr AndrewFerr requested a review from a team as a code owner September 30, 2022 05:19
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

One comment, otherwise LGTM

src/Widgets/BridgeWidgetApi.ts Show resolved Hide resolved
@AndrewFerr
Copy link
Member Author

Before submitting this, there's a type error added by this change that yarn lint missed which I'll try fixing.

https://github.com/matrix-org/matrix-hookshot/pull/505/files#diff-e9a8de0579bab9c5fea95a16abc38388d4f7b0712ea52c581238f6d4c6fccaa7R132

That change to the type of filters fixes lint errors, but causes mismatched-type errors when calling that function in places like this:
https://github.com/matrix-org/matrix-hookshot/blob/main/web/components/roomConfig/GitlabRepoConfig.tsx#L21

Argument of type 'GitLabTargetFilter' is not assignable to parameter of type 'Record<string, string> | Record<string, never> | undefined'.
  Type 'GitLabTargetFilter' is not assignable to type 'Record<string, never>'.

Basically, I want a type that can cover {}, undefined, and a Record<string, string>, but without using {} as a type, which the linter considers an error.

Base automatically changed from af/jira-widget to main September 30, 2022 15:52
@AndrewFerr
Copy link
Member Author

Actually, I'll rebase this before merging, since it was based on the tip of the widgets branch.

@AndrewFerr AndrewFerr merged commit 80a2628 into main Sep 30, 2022
@AndrewFerr AndrewFerr deleted the af/typing-fixes branch September 30, 2022 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants