daml/language-support
Gary Verhaegen 7a5940d076
ts: generated code includes Template.QueryResult (#8315)
See [discourse].

[discourse]: https://discuss.daml.com/t/best-practice-for-getting-ledger-state-in-multiple-nested-react-components/1814/3

CHANGELOG_BEGIN

* [JavaScript Client Libraries] When using our React wrapper from
  TypeScript, users could end up having to manually reconstruct a
  `QueryResult` type for a specific template, leading to code looking
  like (assuming a `User` template):
  ```
  const allUser: QueryResult<User.User, User.User.Key, typeof User.User.templateId> = useStreamQueries(User.User);
  ```
  Our codegen will now generate an additional type definition per
  template such that the above can be rewritten as
  ```
  const allUser: User.User.QueryResult = useStreamQueries(User.User);
  ```
  Developers using our JavaScript bindings directly (i.e. without taking
  advantage of the TS type definitions) are not affected. Existing
  (long-form) type declaractions will also keep working.

  Note: In order to make this change, we had to move the definition of
  the `QueryResult` type from the `@daml/react` package to the
  `@daml/ledger` package. However, the `@daml/react` package is still
  exporting it as before, so this is a backwards-compatible change.

CHANGELOG_END
2020-12-16 14:31:36 +01:00
..
codegen-common Upgrade rules-scala and scalatest (#8187) 2020-12-08 06:59:23 +01:00
codegen-main Use com.daml as root package (#5343) 2020-04-05 19:49:57 +02:00
hs/bindings Prepare the ledger API for multi-party submissions [KVL-710] (#8125) 2020-12-07 16:17:05 +01:00
java replace new Prim with Prim.valueOf (#8270) 2020-12-11 18:50:37 +01:00
scala Upgrade Scala dependencies for 2.13 compatibility (#8268) 2020-12-14 09:59:00 +01:00
ts ts: generated code includes Template.QueryResult (#8315) 2020-12-16 14:31:36 +01:00