Files

35 lines
1.3 KiB
TypeScript

/**
* Registers @hanzo/gui's v5 config with the type system so the shorthand style
* props the components take — `px`, `mx`, `minH`, `maxW`, `items`, `justify`,
* `bg`, `flex` — resolve to their concrete types.
*
* It reads THIS app's own config (`lib/gui`), not the v5 defaults — the themes
* here carry `$ink` and `$soft`, which the default palette does not, so
* augmenting with the defaults leaves 829 colour props unresolved while fixing
* the layout ones.
*
* The config sets `onlyShorthandStyleProps`, so the shorthands ARE the API.
* Without this augmentation TypeScript sees only the base React Native props
* and reads every shorthand as an unknown attribute: 2,496 errors across this
* repo, all of them TS2322/TS2353 on props that are correct at runtime, which
* is why the pages render and the type gate still fails.
*
* Ambient and type-only — it emits nothing.
*/
import type config from '@/lib/gui'
type Conf = typeof config
declare module '@hanzogui/web' {
interface GuiCustomConfig extends Conf {}
/** Named size containers, for `$group-<name>-<media>`: `plot` is the
* accuracy-cost scatter's card, whose width picks the plot's geometry. */
interface TypeOverride {
groupNames(): 'plot'
}
}
declare module '@hanzogui/core' {
interface GuiCustomConfig extends Conf {}
}