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

Core data: Fix minor type issue in onSubKey #39655

Merged
merged 2 commits into from
Mar 31, 2022

Commits on Mar 22, 2022

  1. Core data: Fix minor type issue in onSubKey

    Part of #39211
    
    The `Function` type in `onSubKey` caused an issue when enabling TypeScript
    for the `core-data` module (when analyzing JS files) because it's not a
    callable interface.
    
    In this patch we're creating a transition type `AnyFunction` and using that
    as the type in `onSubKey` to remove the type error.
    
    After enabling TypeScript for the module we'll be able to provide better
    types on the function directly, but for now this prevents raising an error.
    
    We want to do great things with the `core-data` type system but all of these
    little nuisances get in the way when we're trying to study those things in
    isolation. This is a preparatory change to eliminate some of the noise in the
    existing types.
    
    As a type-only change this will have no impact on the built code.
    Please audit the types and the introduction of the `types.ts` where
    we import an actual TypeScript type into JSDoc through `@typedef`.
    
    Note that this change doesn't "fully-type" `onSubKey` in the sense
    that it provides full inference for the passed-through reducer.
    The goal is merely to avoid creating type errors when activating
    TypeScript across the module.
    dmsnell committed Mar 22, 2022
    Configuration menu
    Copy the full SHA
    a5dc498 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fa053d5 View commit details
    Browse the repository at this point in the history