Skip to content

Commit 840ba11

Browse files
authored
Use Array shorthand - Type[] instead of Array<Type> (#168)
1 parent 49504c3 commit 840ba11

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public Symbol booleanShape(BooleanShape shape) {
124124
@Override
125125
public Symbol listShape(ListShape shape) {
126126
Symbol reference = toSymbol(shape.getMember());
127-
return createSymbolBuilder(shape, format("Array<%s>", reference.getName()), null)
127+
return createSymbolBuilder(shape, format("(%s)[]", reference.getName()), null)
128128
.addReference(reference)
129129
.build();
130130
}

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/DocumentShapeDeserVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public final Void documentShape(DocumentShape shape) {
372372
* const deserializeAws_restJson1_1ParameterList = (
373373
* output: any,
374374
* context: SerdeContext
375-
* ): Array<Parameter> => {
375+
* ): Parameter[] => {
376376
* return (output || []).map((entry: any) =>
377377
* deserializeAws_restJson1_1Parameter(entry, context)
378378
* );

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/DocumentShapeSerVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public final Void documentShape(DocumentShape shape) {
366366
*
367367
* <pre>{@code
368368
* const serializeAws_restJson1_1ParametersList = (
369-
* input: Array<Parameter>,
369+
* input: Parameter[],
370370
* context: SerdeContext
371371
* ): any => {
372372
* return (input || []).map(entry =>

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/SymbolProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void escapesRecursiveSymbols() {
101101
SymbolProvider provider = TypeScriptCodegenPlugin.createSymbolProvider(model);
102102
Symbol listSymbol = provider.toSymbol(list);
103103

104-
assertThat(listSymbol.getName(), equalTo("Array<_Record>"));
104+
assertThat(listSymbol.getName(), equalTo("(_Record)[]"));
105105
}
106106

107107
@Test

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberDeserVisitorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private static final class MockProvider implements SymbolProvider {
118118
.namespace("com.smithy.example", "/")
119119
.build();
120120
private Symbol collectionMock = Symbol.builder()
121-
.name("Array<Foo>")
121+
.name("Foo[]")
122122
.namespace("com.smithy.example", "/")
123123
.build();
124124

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberSerVisitorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private static final class MockProvider implements SymbolProvider {
121121
.namespace("com.smithy.example", "/")
122122
.build();
123123
private Symbol collectionMock = Symbol.builder()
124-
.name("Array<Foo>")
124+
.name("Foo[]")
125125
.namespace("com.smithy.example", "/")
126126
.build();
127127

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/integration/ProtocolGeneratorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void buildsSerFunctionNameForCollection() {
3939
.member(member)
4040
.build();
4141
Symbol symbol = Symbol.builder()
42-
.name("Array<Foo>")
42+
.name("Foo[]")
4343
.namespace("com.smithy.example", ".")
4444
.putProperty("shape", list)
4545
.build();
@@ -72,7 +72,7 @@ public void buildsDeserFunctionNameForCollection() {
7272
.member(member)
7373
.build();
7474
Symbol symbol = Symbol.builder()
75-
.name("Array<Foo>")
75+
.name("Foo[]")
7676
.namespace("com.smithy.example", ".")
7777
.putProperty("shape", list)
7878
.build();

0 commit comments

Comments
 (0)