Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
303 stars 191 forks source link

Function assertion types for pattern assertions #4917

Open turadg opened 2 years ago

turadg commented 2 years ago

What is the Problem Being Solved?

Assertion functions in https://github.com/Agoric/agoric-sdk/blob/master/packages/store/src/patterns/patternMatchers.js throws if a specimen doesn't match a pattern, but it doesn't inform the type system of and the developer has to manual annotate a type to match the pattern.

Description of the Design

Use Assertion Functions from TS 3.7 to narrow the type after a successful call a pattern assertion. cc @erights

Study similar utilities:

Security Considerations

Test Plan

Tartuffo commented 2 years ago

@erights please review and confirm this should wait to MN-1.1

erights commented 2 years ago

Confirmed.

On Thu, Apr 14, 2022 at 1:08 PM Nick Lai @.***> wrote:

@erights https://github.com/erights please review and confirm this should wait to MN-1.1

— Reply to this email directly, view it on GitHub https://github.com/Agoric/agoric-sdk/issues/4917#issuecomment-1099420490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACC3TF4V64PJX2EB2CAKRDVFBGJTANCNFSM5RU54JGA . You are receiving this because you were mentioned.Message ID: @.***>

-- Cheers, --MarkM