File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
packages/hypergraph-react/src/internal Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,11 @@ export const parseResult = <S extends Schema.Schema.AnyNoContext>(queryData: Ent
185
185
const ast = type . ast as SchemaAST . TypeLiteral ;
186
186
187
187
for ( const prop of ast . propertySignatures ) {
188
- const propType = prop . isOptional ? prop . type . types [ 0 ] : prop . type ;
188
+ const propType =
189
+ prop . isOptional && SchemaAST . isUnion ( prop . type )
190
+ ? ( prop . type . types . find ( ( member ) => ! SchemaAST . isUndefinedKeyword ( member ) ) ?? prop . type )
191
+ : prop . type ;
192
+
189
193
const result = SchemaAST . getAnnotation < string > ( Constants . PropertyIdSymbol ) ( propType ) ;
190
194
191
195
if ( Option . isSome ( result ) ) {
Original file line number Diff line number Diff line change @@ -200,7 +200,11 @@ export const parseResult = <S extends Schema.Schema.AnyNoContext>(queryData: Ent
200
200
const ast = type . ast as SchemaAST . TypeLiteral ;
201
201
202
202
for ( const prop of ast . propertySignatures ) {
203
- const propType = prop . isOptional ? prop . type . types [ 0 ] : prop . type ;
203
+ const propType =
204
+ prop . isOptional && SchemaAST . isUnion ( prop . type )
205
+ ? ( prop . type . types . find ( ( member ) => ! SchemaAST . isUndefinedKeyword ( member ) ) ?? prop . type )
206
+ : prop . type ;
207
+
204
208
const result = SchemaAST . getAnnotation < string > ( Constants . PropertyIdSymbol ) ( propType ) ;
205
209
206
210
if ( Option . isSome ( result ) ) {
You can’t perform that action at this time.
0 commit comments