-
Notifications
You must be signed in to change notification settings - Fork 205
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
static type improvements to contracts #6287
Conversation
b36b8a8
to
5c54498
Compare
packages/ERTP/src/amountMath.js
Outdated
@@ -254,6 +255,7 @@ const AmountMath = { | |||
assertRemotable(brand, 'brand'); | |||
assertAssetKind(assetKind); | |||
const value = helpers[assetKind].doMakeEmpty(); | |||
// @ts-expect-error TS/jsdoc things 'nat' can't be assigned to K subclassing AssetKind |
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.
// @ts-expect-error TS/jsdoc things 'nat' can't be assigned to K subclassing AssetKind | |
// @ts-expect-error TS/jsdoc thinks 'nat' can't be assigned to K subclassing AssetKind |
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 thought I fixed this but I see it's not pushed. When you approve I'll do a rebase to fixup the commit this was in and force push. (Holding off on that so I don't make it harder to review)
export type Brand = unknown; | ||
export type Amount = { brand: Brand; value: bigint }; | ||
export type Instance = unknown; | ||
export type Proposal = 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.
Why are these being left untyped?
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.
Explained in a comment
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.
you mean the line above that says
types that are only provided ambiently have to be defined.
Why is it better to declare them as unknown
or any
than to copy their actual types? Does the CLI not rely on their values?
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.
Does the CLI not rely on their values?
Well the runtime doesn't rely on these typedefs at all. This package doesn't export anything to consumes so the types are there for dx productivity. The trade-off here is that there's more productivity to be gained by leaving them as is (vs spending more time on this).
Why is it better to declare them as unknown or any than to copy their actual types?
The runtime types also don't match because the CLI gets its values from RPC and doesn't have CapTP to translate them into regular objects. That's what the xxx RpcRemote
comments are about.
// FIXME import InterfaceGuard from @agoric/store | ||
/** @typedef {*} InterfaceGuard */ |
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.
why not do the import now?
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.
The type isn't available. Documented in 17aea73
556b159
to
84788a9
Compare
Pulled out of #6256 , to punt on ERTP package exports.
Description
Various commits to increase type coverage.
One new types feature is that the Installation type carries through to offer args validation and offer results, so we no longer need to cast (or guess) those.
Security Considerations
n/a, static types
Documentation Considerations
--
Testing Considerations
Types check