Skip to content

Conversation

@semanticart
Copy link
Contributor

@semanticart semanticart commented Mar 27, 2025

  • Adds new typesafe functionality with PrefabTypesafeClass and usePrefabTypesafe hook
  • Adds createPrefabHook for creating typed hooks
  • Adds ProvidedContext for better type safety

Usage:

  • With the (yet unreleased) CLI code gen, generate a typed client typescript file. That client will export usePrefabConfig and the class PrefabTypesafe
  • Initialize your PrefabProvider with PrefabTypesafeClass={PrefabTypesafe} (importing from the generated file)
  • import { usePrefabConfig } from the generated file instead of import { usePrefab }
  • const { someConfig, someFlag } = usePrefabConfig(); will give you typed versions of your config.

- Adds new typesafe functionality with PrefabTypesafeClass and
  usePrefabTypesafe hook
- Adds createPrefabHook for creating typed hooks
- Adds ProvidedContext for better type safety
@semanticart semanticart requested review from a team as code owners March 27, 2025 13:32
@semanticart semanticart merged commit d46e65e into main Mar 27, 2025
1 check passed
@semanticart semanticart deleted the typesafe branch March 27, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants