-
Notifications
You must be signed in to change notification settings - Fork 214
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
Tagged helper for StartFunction #9315
Conversation
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.
good stuff!
@@ -0,0 +1,155 @@ | |||
/** @file adapted from https://raw.githubusercontent.com/sindresorhus/type-fest/main/source/opaque.d.ts */ |
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.
What's the license? ah. CC0 Public Domain Dedication. very well.
might be worth noting that.
// because TS is structural, without this the generic is ignored | ||
[StartFunction]: SF; | ||
}; | ||
export type Installation<SF extends ContractStartFunction | unknown> = Tagged< |
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'm not sure how to read this. X | unknown
is unknown
for any X
, isn't it?
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 used to be SF
which was any
. I constrained it to SF extends ContractStartFunction
but some places explicitly pass unknown
. So this continues to allow that.
@@ -13,22 +14,24 @@ type ContractFacet<T extends {} = {}> = { | |||
/** | |||
* Installation of a contract, typed by its start function. | |||
*/ | |||
declare const StartFunction: unique symbol; |
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.
ok, so no more unique symbol... though we take on responsibility for any collisions for strings such as StartFunction
.
refs: #9283
Description
#9283 was failing integration with,
I've been meaning to adopt the
Tagged
helper from types-fest so I took this opportunity to try it and it solved this problem. So this PR adds it to@agoric/internal
and uses it for theInstallation
andInstance
types that need a tag. It doesn't use if for the three otherdeclare const
we have in the repo.While debugging I also noticed we could cut a few ambient runtime imports so I did that. One required moving ManualTimer type into its impl module.
Security Considerations
I vendored the file instead of importing from NPM to not take the external dep
Scaling Considerations
n/a, types
Documentation Considerations
should not be developer-facing
Testing Considerations
CI
Upgrade Considerations
n/a, types