You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm following the overlay guidance found in the docs and it looks like when overlays are used, a lot of options are statically configured inside the overlay definition and cannot be modified in the constructor.
In the following example, timestamps are set to true in the type definition (source), which causes an error when I try to set timestamps to false in the constructor.
new Entity<"Foo", FooItem, CompositeKey, typeof table>({
name: "Foo",
// !!! ERROR !!! : Type 'false' is not assignable to type 'true'.ts(2322)
timestamps: false,
attributes: {
pk: { partitionKey: true },
sk: { sortKey: true },
},
table,
} as const);
I can "fix" this by giving a more elaborate overlay definition like so, which changes (corrects?) the type and allows input again.
new Entity<
"Foo",
FooItem,
CompositeKey,
typeof table,
boolean,
boolean,
boolean,
string,
string
>({
name: "Foo",
// it works now!
timestamps: false,
attributes: {
pk: { partitionKey: true },
sk: { sortKey: true },
},
table,
} as const);
I'm admittedly not a Typescript wizard so I may be doing something wrong (and please correct me if I am), but this doesn't seem to be expected behavior.
dynamodb-toolbox v0.9.3
The text was updated successfully, but these errors were encountered:
cameroncf
changed the title
Overlays breaks many constructor inputs
Overlays break many constructor inputs
Apr 23, 2024
I'm following the overlay guidance found in the docs and it looks like when overlays are used, a lot of options are statically configured inside the overlay definition and cannot be modified in the constructor.
In the following example, timestamps are set to true in the type definition (source), which causes an error when I try to set timestamps to false in the constructor.
I can "fix" this by giving a more elaborate overlay definition like so, which changes (corrects?) the type and allows input again.
I'm admittedly not a Typescript wizard so I may be doing something wrong (and please correct me if I am), but this doesn't seem to be expected behavior.
The text was updated successfully, but these errors were encountered: