Skip to content

Commit ba793c7

Browse files
authored
chore(codegen): use type symbol when writing structure member (#1795)
1 parent cd97706 commit ba793c7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

private/smithy-rpcv2-cbor/src/models/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// smithy-typescript generated code
22
import type { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
33

4-
import { ComplexNestedErrorData, ValidationExceptionField } from "./models_0";
4+
import { type ComplexNestedErrorData, ValidationExceptionField } from "./models_0";
55
import { RpcV2ProtocolServiceException as __BaseException } from "./RpcV2ProtocolServiceException";
66

77
/**

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructuredMemberWriter.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,15 @@ void writeMembers(TypeScriptWriter writer, Shape shape) {
109109
if (optionalSuffix.equals("?")) {
110110
typeSuffix = " | undefined"; // support exactOptionalPropertyTypes.
111111
}
112-
writer.write("${L}${L}${L}: ${T}${L};", memberPrefix, memberName, optionalSuffix,
113-
symbolProvider.toSymbol(member), typeSuffix);
112+
writer.write(
113+
"${L}${L}${L}: ${T}${L};",
114+
memberPrefix, memberName, optionalSuffix,
115+
symbolProvider.toSymbol(member)
116+
.toBuilder()
117+
.putProperty("typeOnly", true)
118+
.build(),
119+
typeSuffix
120+
);
114121

115122
if (wroteDocs && position < members.size() - 1) {
116123
writer.write("");

0 commit comments

Comments
 (0)