Skip to content

Add literal types#349

Merged
Lipen merged 2 commits intoneofrom
lipen/literal-type
Aug 20, 2025
Merged

Add literal types#349
Lipen merged 2 commits intoneofrom
lipen/literal-type

Conversation

@Lipen
Copy link
Copy Markdown
Member

@Lipen Lipen commented Aug 19, 2025

This PR adds proper support for different TS literal types: string/number/boolean. Each literal class is now represented as a separate data class under the sealed interface EtsLiteralType.

@Lipen Lipen requested review from CaelmBleidd and Copilot August 19, 2025 13:10
Copy link
Copy Markdown

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 refactors TypeScript literal type support by replacing the generic EtsLiteralType with specific literal type classes for different value types. The refactoring changes the single EtsLiteralType data class into a sealed interface with three implementing data classes: EtsStringLiteralType, EtsNumberLiteralType, and EtsBooleanLiteralType.

  • Converts EtsLiteralType from a data class to a sealed interface
  • Adds three specific literal type implementations with type-safe value storage
  • Updates the visitor pattern to handle each literal type separately
  • Enhances JSON deserialization to properly handle different literal value types

Reviewed Changes

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

File Description
Type.kt Refactors literal type hierarchy from single class to sealed interface with three implementations
Convert.kt Updates JSON-to-type conversion to map literal values to appropriate type classes
EtsFromJsonTest.kt Adds comprehensive test coverage for all literal type variants

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

  217 files  ±0    217 suites  ±0   15m 57s ⏱️ +5s
  737 tests +8    725 ✅ +8  12 💤 ±0  0 ❌ ±0 
2 005 runs  +8  1 955 ✅ +8  50 💤 ±0  0 ❌ ±0 

Results for commit f3655cb. ± Comparison against base commit 0a50288.

@Lipen Lipen merged commit d3e9720 into neo Aug 20, 2025
10 checks passed
@Lipen Lipen deleted the lipen/literal-type branch August 20, 2025 14:32
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