Skip to content

Add support for typeof unary operator#304

Closed
trevordixon wants to merge 1 commit intoTroyAlford:developfrom
trevordixon:unary-typeof
Closed

Add support for typeof unary operator#304
trevordixon wants to merge 1 commit intoTroyAlford:developfrom
trevordixon:unary-typeof

Conversation

@trevordixon
Copy link

@trevordixon trevordixon commented Jun 5, 2025

Turns out the unary operations tests weren't actually testing anything. ({ operation, expected } ) => ... should have been (operation, expected) => ... (two params, not destructured). The test cases I commented out don't work, because for those values, instance.ParsedChildren is an empty array, so the expectation doesn't hold. A different method is needed to test if they're getting parsed properly.

@trevordixon
Copy link
Author

Hey Troy, how do you feel about this? I know it isn't ideal commenting out tests, but they weren't really running anyway.

@trevordixon
Copy link
Author

Hi Troy, one more polite ping :D

@TroyAlford
Copy link
Owner

Hey @trevordixon — sorry for being slow on this. I'm going to merge your changes in alongside some others in #308.

@TroyAlford TroyAlford closed this Sep 19, 2025
TroyAlford added a commit that referenced this pull request Sep 19, 2025
…ng (#308)

## Summary

Refactors TypeScript typings for the `components` prop to support nested component collections and adds support for additional unary operations.

## What Changed

- **Type Safety**: Added `ComponentType` and `ComponentsType` definitions for better component collection support
- **Unary Operations**: Added bitwise NOT (`~`) and `typeof` operator support
- **Error Handling**: Fixed error handling logic to prevent execution on parse errors
- **Developer Experience**: Improved IntelliSense and autocomplete for complex component hierarchies

## Why

- Better type safety when passing nested component collections
- More complete JavaScript expression evaluation
- Cleaner, more maintainable type definitions
- More robust error handling

Closes #297
Closes #304
Closes #305
Closes #306
Closes #307
@TroyAlford
Copy link
Owner

This is now out/available in v2.4.1

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