Skip to content

Commit 912fd77

Browse files
Updates typing
1 parent 16b4307 commit 912fd77

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/autolinks/autolinks.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { IntegrationId } from '../constants.integrations';
55
import { IssueIntegrationId } from '../constants.integrations';
66
import type { Container } from '../container';
77
import type { GitRemote } from '../git/models/remote';
8+
import type { RemoteProviderId } from '../git/remotes/remoteProvider';
89
import { getIssueOrPullRequestHtmlIcon, getIssueOrPullRequestMarkdownIcon } from '../git/utils/-webview/icons';
910
import type { HostingIntegration, Integration, IssueIntegration } from '../plus/integrations/integration';
1011
import { IntegrationBase } from '../plus/integrations/integration';
@@ -223,7 +224,10 @@ export class Autolinks implements Disposable {
223224
integrationId =
224225
link.provider instanceof IntegrationBase
225226
? link.provider.id
226-
: remoteProviderIdToIntegrationId(link.provider.id);
227+
: // TODO: Tighten the typing on ProviderReference to be specific to a remote provider, and then have a separate "integration" property (on autolinks and elsewhere)
228+
// that is of a new type IntegrationReference specific to integrations. Otherwise, make remote provider ids line up directly with integration ids.
229+
// Either way, this converting/casting hackery needs to go away.
230+
remoteProviderIdToIntegrationId(link.provider.id as RemoteProviderId);
227231
if (integrationId == null) {
228232
// Fall back to the old logic assuming that integration id might be saved as provider id.
229233
// TODO: it should be removed when we put providers and integrations in order. Conversation: https://github.com/gitkraken/vscode-gitlens/pull/3996#discussion_r1936422826

src/plus/integrations/integrationService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,9 @@ export class IntegrationService implements Disposable {
10291029
}
10301030
}
10311031

1032-
export function remoteProviderIdToIntegrationId(remoteProviderId: string): SupportedCloudIntegrationIds | undefined {
1032+
export function remoteProviderIdToIntegrationId(
1033+
remoteProviderId: RemoteProviderId,
1034+
): SupportedCloudIntegrationIds | undefined {
10331035
switch (remoteProviderId) {
10341036
case 'azure-devops':
10351037
return HostingIntegrationId.AzureDevOps;

0 commit comments

Comments
 (0)