@@ -2,8 +2,8 @@ import {Codegen, CodegenStepExecJs} from '@jsonjoy.com/codegen';
22import { JsExpression } from '@jsonjoy.com/codegen/lib/util/JsExpression' ;
33import { normalizeAccessor } from '@jsonjoy.com/codegen/lib/util/normalizeAccessor' ;
44import { MaxEncodingOverhead , maxEncodingCapacity } from '@jsonjoy.com/util/lib/json-size' ;
5- import { BoolType , ConType , NumType , ObjKeyOptType } from '../../type' ;
6- import type { ArrType , MapType , ObjKeyType , ObjType , OrType , RefType , Type } from '../../type' ;
5+ import { BoolType , ConType , NumType , KeyOptType } from '../../type' ;
6+ import type { ArrType , MapType , KeyType , ObjType , OrType , RefType , Type } from '../../type' ;
77import { DiscriminatorCodegen } from '../discriminator' ;
88import { lazyKeyedFactory } from '../util' ;
99
@@ -113,10 +113,10 @@ export class CapacityEstimatorCodegen {
113113 this . inc ( MaxEncodingOverhead . Object ) ;
114114 const fields = objectType . keys ;
115115 for ( const f of fields ) {
116- const field = f as ObjKeyType < any , any > ;
116+ const field = f as KeyType < any , any > ;
117117 const accessor = normalizeAccessor ( field . key ) ;
118118 const fieldExpression = new JsExpression ( ( ) => `${ r } ${ accessor } ` ) ;
119- const isOptional = field instanceof ObjKeyOptType ;
119+ const isOptional = field instanceof KeyOptType ;
120120 if ( isOptional ) {
121121 codegen . if ( /* js */ `${ JSON . stringify ( field . key ) } in ${ r } ` , ( ) => {
122122 this . inc ( MaxEncodingOverhead . ObjectElement ) ;
0 commit comments