mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
Use template Key in template generic params list (#4186)
changelog_begin changelog_end Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
This commit is contained in:
parent
78b29852d3
commit
3811b6c191
@ -216,10 +216,7 @@ genDefDataType curPkgId conName mod tpls def =
|
||||
]
|
||||
(keyTypeTs, keySer) = case tplKey tpl of
|
||||
Nothing -> ("undefined", "() => jtv.constant(undefined)")
|
||||
Just key ->
|
||||
let (keyTypeTs, keySer) = genType (moduleName mod) (tplKeyType key)
|
||||
in
|
||||
(keyTypeTs, "() => " <> keySer <> ".decoder()")
|
||||
Just key -> (conName <.> "Key", "() => " <> snd (genType (moduleName mod) (tplKeyType key)) <> ".decoder()")
|
||||
dict =
|
||||
["export const " <> conName <> ": daml.Template<" <> conName <> ", " <> keyTypeTs <> "> & {"] ++
|
||||
[" " <> x <> ": daml.Choice<" <> conName <> ", " <> t <> ", " <> rtyp <> ", " <> keyTypeTs <> ">;" | (x, t, rtyp, _) <- chcs] ++
|
||||
@ -250,10 +247,10 @@ genDefDataType curPkgId conName mod tpls def =
|
||||
] ++
|
||||
["};"]
|
||||
associatedTypes =
|
||||
maybe [] (const $
|
||||
maybe [] (\key ->
|
||||
[ "// eslint-disable-next-line @typescript-eslint/no-namespace"
|
||||
, "export namespace " <> conName <> " {"] ++
|
||||
[" export type Key = " <> keyTypeTs <> ""] ++
|
||||
[" export type Key = " <> fst (genType (moduleName mod) (tplKeyType key)) <> ""] ++
|
||||
["}"]) (tplKey tpl)
|
||||
registrations =
|
||||
["daml.registerTemplate(" <> conName <> ");"]
|
||||
|
Loading…
Reference in New Issue
Block a user