Skip to content

Fix: Allow arbitrary attribute order in triple-slash directives#62821

Closed
Bitshifter-9 wants to merge 1 commit intomicrosoft:mainfrom
Bitshifter-9:fix/triple-slash-attribute-order
Closed

Fix: Allow arbitrary attribute order in triple-slash directives#62821
Bitshifter-9 wants to merge 1 commit intomicrosoft:mainfrom
Bitshifter-9:fix/triple-slash-attribute-order

Conversation

@Bitshifter-9
Copy link
Copy Markdown

Refactored createGroupChannel in server/channels/app/channel.go
to use SaveMultipleMembers for saving channel members, replacing the previous loop of individual SaveMember calls.

The Problem
The previous implementation of
createGroupChannel
iterated through the list of users and called SaveMember for each one. This resulted in N+1 database queries (where N is the number of users in the group), which is inefficient and can lead to performance issues as the group size increases.

The Solution
I replaced the loop with a single call to SaveMultipleMembers, which allows inserting all channel members in a single database operation (or fewer operations depending on the store implementation). This significantly reduces the database overhead.

Copilot AI review requested due to automatic review settings December 2, 2025 06:15
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Dec 2, 2025
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Dec 2, 2025
@typescript-bot
Copy link
Copy Markdown
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

1 similar comment
@typescript-bot
Copy link
Copy Markdown
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a parser bug where triple-slash reference directives required attributes to be in a specific order. The title accurately describes the change ("Fix: Allow arbitrary attribute order in triple-slash directives"), but the description is completely incorrect and appears to be from a different pull request about Go/Mattermost database optimization.

Key Changes

  • Updated regex patterns for fullTripleSlashReferencePathRegEx and fullTripleSlashReferenceTypeReferenceDirectiveRegEx to allow optional attributes before the main path or types attribute
  • Added a test case demonstrating that <reference resolution-mode="import" path="./foo.d.ts" /> now works correctly
  • Applied consistent formatting/indentation improvements throughout src/compiler/utilities.ts for better code readability

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/cases/compiler/tripleSlashAttributeOrder.ts New test case verifying triple-slash directive with resolution-mode before path
tests/baselines/reference/tripleSlashAttributeOrder.types Baseline showing correct type resolution through the non-standard attribute order
tests/baselines/reference/tripleSlashAttributeOrder.symbols Baseline showing correct symbol resolution through the non-standard attribute order
tests/baselines/reference/tripleSlashAttributeOrder.js Baseline showing correct JavaScript emission (directive preserved in output)
src/compiler/utilities.ts Core fix: updated regex patterns with (?:[^>]*?\s+)? to match optional attributes before main attribute; also includes extensive formatting improvements for multi-line conditionals

Comment on lines +1 to +6
// @Filename: /foo.d.ts
declare const foo: number;

// @Filename: /index.ts
/// <reference resolution-mode="import" path="./foo.d.ts" />
foo;
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

PR Metadata Issue: The PR title mentions "Fix: Allow arbitrary attribute order in triple-slash directives" but the description talks about "createGroupChannel in server/channels/app/channel.go". This description appears to be from a completely different pull request (likely a Go/Mattermost server PR about database optimization). The PR description should be updated to match the actual changes being made to TypeScript's triple-slash directive parsing.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6
/// <reference resolution-mode="import" path="./foo.d.ts" />
foo;
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The test only covers the case where resolution-mode appears before path. Consider adding a test case for the traditional order (path before resolution-mode) to ensure backward compatibility and that both orderings work correctly. For example:

/// <reference path="./foo.d.ts" resolution-mode="import" />

Copilot uses AI. Check for mistakes.
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants