JavaScript Libs ContractId type conversion regression
See original GitHub issueA forum user pointed out a regression when upgrading the da-marketplace app from Connect 1.7 to 1.10.
It looks like there used to be a successful type inference from string
to ContractId<AssetDeposit>
in https://github.com/digital-asset/da-marketplace/blob/master/ui/src/components/Broker/BrokerOrders.tsx#L163. However, this now fails.
A workaround is to manually cast the string
:
const handleAcceptBrokerOrderFill = async () => {
const key = wrapDamlTuple([props.cdata.broker, props.cdata.brokerOrderId])
const cid = depositCid as ContractId<AssetDeposit>
const args = { depositCid: cid }
await ledger.exerciseByKey(BrokerOrder.BrokerOrder_Fill, key, args);
setDepositCid('');
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Coercion and Type Conversion in JavaScript
As the name implies, type conversion is the process of converting a value from one type to another. Values in JavaScript can be...
Read more >Regression libraries for NodeJS
ML.js contains a number of different regressions, including linear, polynomial, multivariate and logistic. Documentation is good, and there is a ...
Read more >Type Regression Testing to Detect Breaking Changes in Node ...
The type checker in Java detects type-related breaking changes, but not semantic ones. Our goal is to provide a mechanism that can similarly...
Read more >Data Type Conversion In JavaScript
It will convert them automatically and provide you with some result. That means JavaScript coerces data types to be converted when they need...
Read more >JS-quantities - GitHub Pages
JavaScript library for quantity calculation and unit conversion. ... Qty.getKinds(); // => Array of names of every well-known kind of units ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d got for
ContractId<AssetDeposit> | undefined
but yeah something along those lines.Thanks for the detective work. Makes perfect sense. I guess the correct solution would be to type the state properly: