-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Upcomming Feature : 1.1.9 - DX Improvement and Type Safety Ehnancement - [https://github.com//issues/20]
Upcoming, Overwatch uses an internal KeyRegistry to map shared state keys to their types for type-safe usage with useSharedState and usePicker. However, this approach does not scale when Overwatch is used as a distributed package since:
Branch to use - Dx-Typescript/Key-Registery
Imports inside node_modules cannot directly access user project files (keyRegistry.ts).
Relative imports break when expecting keyRegistry.ts at the project root.
- Problem Statement
We need a clean, scalable way for Overwatch to support a KeyRegistry defined by users in their project root while maintaining type safety, without breaking when installed via npm.
Goals
- Allow users to define and maintain keyRegistry.ts in their projects.
- Enable Overwatch to leverage this for type inference in useSharedState and usePicker.
- Avoid forcing runtime overhead or breaking builds if the file is absent.
- Keep zero-config for users if they do not wish to use type safety.
π‘ Potential Approaches
Paths Mapping in tsconfig.json
Require users to add:
"paths": {
"overwatch-keyRegistry": ["./overwatch/keyRegistry.ts"]
}and import:
import type { KeyRegistry } from "overwatch-keyRegistry";β
Works reliably with TypeScript
β Requires manual user setup (DX tradeoff)
π Feedback Requested
Please provide:
β
Your preferred approach
β
Any potential DX concerns
β
Questions or suggestions