Skip to content
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

agoric/store types don't check #7507

Open
turadg opened this issue Apr 25, 2023 · 1 comment
Open

agoric/store types don't check #7507

turadg opened this issue Apr 25, 2023 · 1 comment
Labels
bug Something isn't working code-style defensive correctness patterns; readability thru consistency devex developer experience vaults_triage DO NOT USE

Comments

@turadg
Copy link
Member

turadg commented Apr 25, 2023

Describe the bug

Most or all of the Store types don't report type errors because they're parameterized with any (Key and/or Passable which are defined as any)

Were this bug not present we would have avoided these bugs (partial list):

To Reproduce

For example,

  /** @type {SetStore<import('@agoric/vat-data').Baggage>} The set of baggages for zcfMints */
  const zcfMintBaggageSet = provideDurableSetStore(zcfBaggage, 'baggageSet');
  // @ts-expect-error but doesn't
  zcfMintBaggageSet.add(null);
*/

Expected behavior

Invalid type usage shows and error and fails CI

Additional context

Requires changes in Endo, including endojs/endo#1488

@turadg turadg added bug Something isn't working code-style defensive correctness patterns; readability thru consistency devex developer experience labels Apr 25, 2023
@ivanlei ivanlei added the vaults_triage DO NOT USE label Apr 27, 2023
@dckc
Copy link
Member

dckc commented Aug 16, 2023

@turadg you asked if we can do better than any as a typedef for passable. I did some relevant work in...

The .ts definition there is for OCapn value, but it's isomorphic to passable (with the exception that OCapn hasn't decided whether to distinguish promises from remotables). There's also an attempt at doing passable in .proto.

I think I did one in idris nearby, fwiw... Passable.idr
ocapn/ocapn#5 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code-style defensive correctness patterns; readability thru consistency devex developer experience vaults_triage DO NOT USE
Projects
None yet
Development

No branches or pull requests

3 participants