Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constrain contract ID types when invoking interface-member choices #14132

Closed
S11001001 opened this issue Jun 8, 2022 · 0 comments · Fixed by #14134
Closed

constrain contract ID types when invoking interface-member choices #14132

S11001001 opened this issue Jun 8, 2022 · 0 comments · Fixed by #14134
Assignees
Labels
component/js-ecosystem TypeScript and React.js bindings discussion Things to be discussed and decided ledger clients facade enriching the ledger API by bindings/codegen, JSON API, custom view roadmap/interfaces https://digitalasset.atlassian.net/browse/DAML-56 team/ledger-clients Related to the Ledger Clients team's components.

Comments

@S11001001
Copy link
Contributor

S11001001 commented Jun 8, 2022

As of #14092, these are well-typed with respect to atContractId and choicePayload, regardless of whether the choices Mine, Another, Split were defined with ActualTemplate or inherited from an interface:

myLedger.exercise(ActualTemplate.Mine, atContractId, choicePayload)
myLedger.exercise(ActualTemplate.Another, atContractId, choicePayload)
myLedger.exercise(ActualTemplate.Split, atContractId, choicePayload)

However, this is not well-typed with respect to atContractId, though it still is with respect to choicePayload:

myLedger.exercise(SomeInterface.Split, atContractId, choicePayload)

We currently recommend that users invoke the inherited choice (a la Another above) where that is possible in order to preserve type-checking, but adding overloads causes them to be removed from inheritance.

The task here is to find a way in TypeScript to allow only atContractId either typed by SomeInterface or a template known to implement SomeInterface. Then we should consider removing inheritance.

See #14092 (comment) for context.

@S11001001 S11001001 added component/js-ecosystem TypeScript and React.js bindings team/ledger-clients Related to the Ledger Clients team's components. labels Jun 8, 2022
@S11001001 S11001001 added the roadmap/interfaces https://digitalasset.atlassian.net/browse/DAML-56 label Jun 8, 2022
@S11001001 S11001001 self-assigned this Jun 8, 2022
@S11001001 S11001001 added the discussion Things to be discussed and decided label Jun 9, 2022
@S11001001 S11001001 changed the title constraint contract ID types when invoking interface-member choices constrain contract ID types when invoking interface-member choices Jun 27, 2022
@S11001001 S11001001 added the ledger clients facade enriching the ledger API by bindings/codegen, JSON API, custom view label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/js-ecosystem TypeScript and React.js bindings discussion Things to be discussed and decided ledger clients facade enriching the ledger API by bindings/codegen, JSON API, custom view roadmap/interfaces https://digitalasset.atlassian.net/browse/DAML-56 team/ledger-clients Related to the Ledger Clients team's components.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant