-
Notifications
You must be signed in to change notification settings - Fork 191
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
feat(zoe): add type inference for issuerKeywordRecord in ZCF #9330
base: master
Are you sure you want to change the base?
Conversation
- update ZCF type to accept a generic parameter for issuerKeywordRecord (IKR) - modify StandardTerms and related types to use the issuerKeywordRecord generic - preserve existing default of `<Keyword, <Issuer<any>>` when IKR parameter is undefined
Deploying agoric-sdk with Cloudflare Pages
|
type ZCF<CT extends unknown = Record<string, unknown>> = { | ||
type ZCF< | ||
CT extends unknown = Record<string, unknown>, | ||
IKR extends Record<Keyword, AssetKind> = Record<Keyword, any>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you'll add some docs.
(again, it sure would be nice to be able to re-use the examples from the tests as docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @typedef {Record<Keyword, Issuer<any>>} IssuerKeywordRecord | ||
* @typedef {Record<Keyword, ERef<Issuer<any>>>} IssuerPKeywordRecord | ||
* @typedef {Record<Keyword, Brand<any>>} BrandKeywordRecord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these types should be maintained.
when there is a more specific type, it's a concrete type that extends this more general one, not a parameterization of this.
*/ | ||
|
||
/** | ||
* @template {Record<Keyword, AssetKind>} [IKR=Record<Keyword, any>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @template {Record<Keyword, AssetKind>} [IKR=Record<Keyword, any>] | |
* @template {IssuerKeywordRecord} [IKR=IssuerKeywordRecord] |
* @typedef {object} StandardTerms | ||
* @property {IssuerKeywordRecord} issuers - record with | ||
* @property {IssuerKeywordRecord<IKR>} issuers - record with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @property {IssuerKeywordRecord<IKR>} issuers - record with | |
* @property {IKR} issuers - record with |
* keywords keys, issuer values | ||
* @property {BrandKeywordRecord} brands - record with keywords | ||
* @property {BrandKeywordRecord<IKR>} brands - record with keywords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one will take a little type-fu to make a BrandKeywordRecord from an IssuerKeywordRecord. that can be a utility type.
the upside is that brands
will be the actual brands
closes: #XXXX
refs: #XXXX
Description
IKR
(IssuerKeywordRecord
) generic parameter toZCF
to enable type inference forissuers
andbrands
from contract termsCollateral
orIn
.Security Considerations
Scaling Considerations
Documentation Considerations
Testing Considerations
Upgrade Considerations