Shapes aren't that fun to write.
sam-goodwin opened this issue · comments
sam commented
Shapes enable the generic data structures and APIs of Punchcard, but their type signatures can be excessive spaghetti.
E.g.
const table: DynamoDB.Table<"id", undefined, {
id: StringShape;
count: IntegerShape;
name: StringShape;
array: ArrayShape<StringShape>;
struct: StructShape<...>;
any: DynamicShape<...>;
}>
Perhaps we should look into generating Shapes from another representation, e.g. Smithy (https://github.com/awslabs/smithy) or GraphQL (https://graphql.org/, #86)?
The generated code could generate boilerplate interfaces instead of computing types with RuntimeShape<S>
, resulting in more helpful (well documented) hints from the compiler/IDE toolchain. Developer experience would be just as "nice", except there would now be a new file format.
sam commented
Interesting code-first approach for GraphQL: https://github.com/MichalLytek/type-graphql