diff --git a/.changeset/green-pears-call.md b/.changeset/green-pears-call.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/green-pears-call.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructuredMemberWriter.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructuredMemberWriter.java index bdc727be080..161a9eeea38 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructuredMemberWriter.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructuredMemberWriter.java @@ -611,9 +611,10 @@ private void writeConstraintValidatorType(TypeScriptWriter writer, Shape shape) Shape collectionMemberTargetShape = model.expectShape(collectionMemberShape.getTarget()); writer.writeInline("Iterable<$T>", getSymbolForValidatedType(collectionMemberTargetShape)); } else if (shape.isMapShape()) { + MapShape mapShape = shape.asMapShape().get(); writer.writeInline("Record<$T, $T>", - getSymbolForValidatedType(((MapShape) shape).getKey()), - getSymbolForValidatedType(((MapShape) shape).getValue()) + getSymbolForValidatedType(mapShape.getKey()), + getSymbolForValidatedType(mapShape.getValue()) ); } else if (shape instanceof SimpleShape) { writer.writeInline("$T", getSymbolForValidatedType(shape)); diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/SymbolVisitor.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/SymbolVisitor.java index 2e43aeb027c..13f495d726c 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/SymbolVisitor.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/SymbolVisitor.java @@ -196,6 +196,7 @@ public Symbol mapShape(MapShape shape) { Symbol key = toSymbol(shape.getKey()); Symbol value = toSymbol(shape.getValue()); return createSymbolBuilder(shape, format("Record<%s, %s>", key.getName(), value.getName()), null) + .addReference(key) .addReference(value) .build(); }