Skip to content

Make kind property readonly in ReferenceListSource#41

Merged
feuersteiner merged 2 commits into39-major-refactor-to-orgnaize-and-split-into-packagesfrom
copilot/sub-pr-40
Feb 25, 2026
Merged

Make kind property readonly in ReferenceListSource#41
feuersteiner merged 2 commits into39-major-refactor-to-orgnaize-and-split-into-packagesfrom
copilot/sub-pr-40

Conversation

Copy link

Copilot AI commented Feb 25, 2026

The kind property on ReferenceListSource was mutable, allowing accidental reassignment post-construction.

Change

  • Added readonly modifier to kind in ReferenceListSource
// before
kind = SourceKind.ReferenceList;

// after
readonly kind = SourceKind.ReferenceList;

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: feuersteiner <18667704+feuersteiner@users.noreply.github.com>
Copilot AI changed the title [WIP] Update core scaffolding and contracts based on review feedback Make kind property readonly in ReferenceListSource Feb 25, 2026
@feuersteiner feuersteiner marked this pull request as ready for review February 25, 2026 19:45
Copilot AI review requested due to automatic review settings February 25, 2026 19:45
@feuersteiner feuersteiner merged commit 0a9f8f0 into 39-major-refactor-to-orgnaize-and-split-into-packages Feb 25, 2026
@feuersteiner feuersteiner deleted the copilot/sub-pr-40 branch February 25, 2026 19:45
Copy link

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 enhances type safety by making the kind property readonly in the ReferenceListSource class, preventing accidental reassignment after construction. The change aligns with TypeScript best practices for immutable discriminator properties.

Changes:

  • Added readonly modifier to the kind property in ReferenceListSource class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


export class ReferenceListSource extends SourceBase {
kind = SourceKind.ReferenceList;
readonly kind = SourceKind.ReferenceList;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

While adding readonly to the kind property is a good practice, this creates an inconsistency with the other source classes in the codebase. The DocumentSource (document.ts:4), ListSource (list.ts:16), and ReferenceDocumentSource (reference-document.ts:4) classes all declare kind without the readonly modifier. Consider applying this change to all source classes for consistency, or document why only ReferenceListSource requires this protection.

Suggested change
readonly kind = SourceKind.ReferenceList;
kind = SourceKind.ReferenceList;

Copilot uses AI. Check for mistakes.
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.

3 participants