diff --git a/src/app/components/generator/McdocRenderer.tsx b/src/app/components/generator/McdocRenderer.tsx index 47c70891..5bc95847 100644 --- a/src/app/components/generator/McdocRenderer.tsx +++ b/src/app/components/generator/McdocRenderer.tsx @@ -4,7 +4,7 @@ import * as json from '@spyglassmc/json' import { JsonArrayNode, JsonBooleanNode, JsonNumberNode, JsonObjectNode, JsonPairNode, JsonStringNode } from '@spyglassmc/json' import { localeQuote } from '@spyglassmc/locales' import type { ListType, LiteralType, McdocType, NumericType, PrimitiveArrayType, StringType, TupleType, UnionType } from '@spyglassmc/mcdoc' -import type { McdocCheckerContext, SimplifiedEnum, SimplifiedMcdocType, SimplifiedMcdocTypeNoUnion, SimplifiedStructType, SimplifyValueNode } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js' +import type { McdocCheckerContext, SimplifiedEnum, SimplifiedMcdocType, SimplifiedMcdocTypeNoUnion, SimplifiedStructType, SimplifiedStructTypePairField, SimplifyValueNode } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js' import { simplify } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js' import { getValues } from '@spyglassmc/mcdoc/lib/runtime/completer/index.js' import { Identifier, ItemStack } from 'deepslate' @@ -604,11 +604,11 @@ function StructBody({ type: outerType, node, makeEdit, ctx }: StructBodyProps) { } const child = pair.value // TODO: correctly determine which dynamic field this is a key for - const fieldType = dynamicFields[0]?.type - if (!fieldType) { + const field = dynamicFields[0] as SimplifiedStructTypePairField | undefined + if (!field) { return <>> } - const childType = simplifyType(fieldType, ctx, child) + const childType = simplifyType(field.type, ctx, child) const makeFieldEdit: MakeEdit = (edit) => { makeEdit(() => { const newChild = edit(child?.range ?? core.Range.create(pair.range.end)) @@ -625,13 +625,13 @@ function StructBody({ type: outerType, node, makeEdit, ctx }: StructBodyProps) { return node }) } - return