Skip to content

Conversation

@kharus
Copy link
Contributor

@kharus kharus commented Mar 13, 2025

No description provided.

@kharus kharus requested a review from Copilot March 13, 2025 01:19
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 converts the Item class hierarchy into a discriminated union by replacing classes with interfaces and helper functions while updating the nnf transformation logic and corresponding tests.

  • Refactors Item.ts to use interfaces and pure functions instead of class inheritance.
  • Updates tests in tests directories to leverage the new discriminated union model and helper functions.
  • Adjusts the Relevance.ts file to use the new Item structure.

Reviewed Changes

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

Show a summary per file
File Description
src/model/Item.ts Conversion from classes to interfaces; addition of helper functions and a top‑level nnf function.
src/model/tests/Item.test.ts Updates tests to use the new helper functions and nnf function.
src/model/Relevance.ts Refactors instance checks to switch on item.type; modifies getChildren behavior.
src/model/tests/Relevance.test.ts Updates test imports and instantiation to use new helper functions.
src/model/tests/ViewHide.test.ts Adapts tests to align with the new Item model via helper functions.
Comments suppressed due to low confidence (1)

src/model/Relevance.ts:50

  • For a 'Not' item, the original behavior returned its child in an array. Now, recursively calling getChildren may omit the child when item.child is a leaf. Consider returning [item.child] for 'Not' to preserve the prior behavior.
case 'Not': return getChildren(item.child);

@kharus kharus merged commit 1bcad4f into main Mar 13, 2025
1 check passed
@kharus kharus deleted the Item-discriminate-union branch March 13, 2025 06:53
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