Open BillAtINeuro opened 1 year ago
@BillAtINeuro thanks for the feedback! Can you help me understand your scenario a little more? From what you've mentioned I'm understanding that TS isn't strongly typing the entities in each row correctly?
Hi @BillAtINeuro. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Hi @BillAtINeuro, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
It's not about Typescript, but about typing the entity fields when creating an entity.
There's info out there about how to accomplish this, but much of it is outdated. Having it explicitly documented with the SDS seems appropriate. I don't have extensive (recent) experience w/ JS/TS, so it may be obvious to some, but I'm sure there's other in my shoes.
After a lot of reading and experimentation I ended up with something like this:
function makeCreateEntity(e: MyTableDef): any {
return {
partitionKey: e.partitionKey,
rowKey: e.rowKey,
a: { value: e.a.toString(), type: "String" },
b: { value: e.b.toString(), type: "String" },
c: { value: (e.c ? e.c.toString() : null), type: "Double" },
d: { value: (e.d ? e.d.toString() : null), type: "Double" },
.........
Which seems to function correctly when the entity is created via client.createEntity()
. I have no idea if this is correct or idiomatic.
If there's another/better way to accomplish this, especially w/ TS, that would be great. I didn't find anything in the SDK docs to indicate that.
Another note: I know that there are EDM type defs, but though I could import them, I couldn't figure out how to use them in the entity. Replacing the type: with them doesn't work in the current client, though there is documentation to that effect on the interwebs.
Thus, concrete examples in the SDK doc would be helpful and an actual standard reference.
I need to specify types when inserting entities as the SDK is guessing incorrectly without them. I've found examples of multiple vintages on the web, but none are working via the new SDK. What's the correct method for this?
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.