Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core data: Fix minor type issue in onSubKey (#39655)
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.
- Loading branch information