Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"typecheck": "tsc --noEmit"
"gen:types": "node scripts/generate-uniwind-types.mjs",
"typecheck": "bun run gen:types && tsc --noEmit"
},
"dependencies": {
"@clerk/expo": "^3.1.8",
Expand Down
29 changes: 29 additions & 0 deletions apps/mobile/scripts/generate-uniwind-types.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Writes apps/mobile/uniwind-types.d.ts with the same content uniwind's metro
// transformer writes when `expo start` runs. The d.ts is gitignored because
// uniwind regenerates it on every metro start, but typecheck (and CI) needs
// it to exist before tsc runs — so we materialise it here.
//
// The themes list must match `withUniwindConfig` defaults in metro.config.js
// (light + dark, plus any extraThemes).
import { writeFileSync } from "node:fs"
import { fileURLToPath } from "node:url"
import { dirname, join } from "node:path"

const themes = ["light", "dark"]

const stringified = `[${themes.map((t) => `'${t}'`).join(", ")}]`

const content = `// NOTE: This file is generated by uniwind and it should not be edited manually.
/// <reference types="uniwind/types" />

declare module 'uniwind' {
export interface UniwindConfig {
themes: readonly ${stringified}
}
}

export {}
`

const out = join(dirname(fileURLToPath(import.meta.url)), "..", "uniwind-types.d.ts")
writeFileSync(out, content)
Loading
Loading