Conversation
Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
…ality working Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
streamich
left a comment
There was a problem hiding this comment.
Make sure to pass linter and formatter when done.
| expect(schema).toStrictEqual({ | ||
| kind: 'tup', | ||
| types: [ | ||
| { kind: 'num' }, | ||
| { kind: 'str' } | ||
| ] | ||
| }); |
There was a problem hiding this comment.
Named fields should wrap the type node in a field node:
| expect(schema).toStrictEqual({ | |
| kind: 'tup', | |
| types: [ | |
| { kind: 'num' }, | |
| { kind: 'str' } | |
| ] | |
| }); | |
| expect(schema).toStrictEqual({ | |
| kind: 'tup', | |
| types: [ | |
| { kind: 'field', key: 'x', value: { kind: 'num' } }, | |
| { kind: 'str' } | |
| ] | |
| }); |
There was a problem hiding this comment.
Updated the schema generation to wrap named fields in field nodes with the expected structure. The schema now correctly shows { kind: 'field', key: 'x', value: { kind: 'num' } } for named tuple members. (957ed5c)
| }); | ||
| }); | ||
|
|
||
| test('tuple toString shows field names when present', () => { |
There was a problem hiding this comment.
Removed the toString test as requested. (957ed5c)
Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
All linting and formatting checks now pass. Used yarn format:fix to auto-fix formatting issues and verified with yarn lint and yarn format. (957ed5c) |
streamich
left a comment
There was a problem hiding this comment.
- Resolve conflicts, push latest.
- Make sure tests, linter, and formatter pass.
Resolved conflicts and merged latest from master. All requirements are now met: ✅ Conflicts resolved: Successfully merged with master, updated to use Changes committed and pushed in 8d7dfc1. |
This PR implements support for naming tuple members using the same
t.prop()syntax used for object properties, as requested in the issue.New Features
Named tuple members
You can now create tuples with named fields:
Mixed named and unnamed members
Tuples can mix named and unnamed members:
Full functionality support
Named tuples work with all existing functionality:
[1, 2]"x": num)Implementation Details
The implementation reuses the existing
ObjectFieldType<K, V>class to maintain consistency with object field naming. TheTupleTypeclass was updated to accept mixedType | ObjectFieldType<any, any>elements, with properinstanceofchecks throughout all codegen paths.Backward Compatibility
All existing tuple functionality remains unchanged:
Testing
Fixes #3.
💡 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.