From a65bdc8c4f2afe67a4ebbb2f83d4ab257ddb1eca Mon Sep 17 00:00:00 2001 From: Solomon Hawk Date: Sat, 26 Oct 2024 13:22:28 -0400 Subject: [PATCH] Move global type declarations to types package --- apps/web/package.json | 1 + apps/web/src/main.tsx | 1 + apps/web/tsconfig.json | 1 - package-lock.json | 13 +++++++++++++ packages/types/README.md | 1 + packages/types/package.json | 15 +++++++++++++++ packages/{auth => types}/src/auth.d.ts | 2 +- packages/types/src/index.d.ts | 2 ++ packages/types/src/react.d.ts | 6 ++++++ packages/ui/package.json | 1 + packages/ui/src/index.ts | 1 + 11 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 packages/types/README.md create mode 100644 packages/types/package.json rename packages/{auth => types}/src/auth.d.ts (82%) create mode 100644 packages/types/src/index.d.ts create mode 100644 packages/types/src/react.d.ts create mode 100644 packages/ui/src/index.ts diff --git a/apps/web/package.json b/apps/web/package.json index 83c84d5..5065da2 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -19,6 +19,7 @@ "@manifold/lib": "*", "@manifold/router": "*", "@manifold/tailwind-config": "*", + "@manifold/types": "^0.0.0", "@manifold/ui": "*", "@manifold/validators": "*", "@radix-ui/react-icons": "^1.3.0", diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx index c0b3262..56b0f3f 100644 --- a/apps/web/src/main.tsx +++ b/apps/web/src/main.tsx @@ -1,3 +1,4 @@ +import "@manifold/types"; import "@manifold/ui/globals.css"; import { StrictMode } from "react"; diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index b5c303c..c4bb012 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -2,7 +2,6 @@ "extends": "@manifold/typescript-config/vite.json", "include": [ "src", - "../../packages/auth/src/auth.d.ts", // Sometimes this is needed for UI auto-imports to work but not always??? "../../packages/ui/**/*.tsx" ], diff --git a/package-lock.json b/package-lock.json index c2bb768..6b98146 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "@manifold/lib": "*", "@manifold/router": "*", "@manifold/tailwind-config": "*", + "@manifold/types": "^0.0.0", "@manifold/ui": "*", "@manifold/validators": "*", "@radix-ui/react-icons": "^1.3.0", @@ -1733,6 +1734,10 @@ "resolved": "packages/config-tailwind", "link": true }, + "node_modules/@manifold/types": { + "resolved": "packages/types", + "link": true + }, "node_modules/@manifold/typescript-config": { "resolved": "packages/config-typescript", "link": true @@ -12456,6 +12461,13 @@ "name": "@manifold/tabol-core", "extraneous": true }, + "packages/types": { + "name": "@manifold/types", + "version": "0.0.0", + "dependencies": { + "@auth/core": "^0.37.2" + } + }, "packages/ui": { "name": "@manifold/ui", "version": "0.0.0", @@ -12463,6 +12475,7 @@ "dependencies": { "@floating-ui/react": "^0.26.25", "@hookform/resolvers": "^3.9.0", + "@manifold/types": "*", "@manifold/validators": "*", "@radix-ui/react-avatar": "^1.1.1", "@radix-ui/react-checkbox": "^1.1.2", diff --git a/packages/types/README.md b/packages/types/README.md new file mode 100644 index 0000000..e35bb85 --- /dev/null +++ b/packages/types/README.md @@ -0,0 +1 @@ +# `@manifold/types` diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 0000000..d901377 --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,15 @@ +{ + "name": "@manifold/types", + "version": "0.0.0", + "private": true, + "type": "module", + "types": "./src/index.d.ts", + "exports": { + ".": "./src/index.d.ts", + "./react": "./src/react.d.ts", + "./auth": "./src/auth.d.ts" + }, + "dependencies": { + "@auth/core": "^0.37.2" + } +} diff --git a/packages/auth/src/auth.d.ts b/packages/types/src/auth.d.ts similarity index 82% rename from packages/auth/src/auth.d.ts rename to packages/types/src/auth.d.ts index d4f4d3a..5287162 100644 --- a/packages/auth/src/auth.d.ts +++ b/packages/types/src/auth.d.ts @@ -1,6 +1,6 @@ import type { DefaultSession } from "@auth/core/types"; -declare module "@auth/core/types" { +export declare module "@auth/core/types" { interface Session { user: { id: string; diff --git a/packages/types/src/index.d.ts b/packages/types/src/index.d.ts new file mode 100644 index 0000000..29689f4 --- /dev/null +++ b/packages/types/src/index.d.ts @@ -0,0 +1,2 @@ +export * from "./auth.d.ts"; +export * from "./react.d.ts"; diff --git a/packages/types/src/react.d.ts b/packages/types/src/react.d.ts new file mode 100644 index 0000000..b8c74b2 --- /dev/null +++ b/packages/types/src/react.d.ts @@ -0,0 +1,6 @@ +export declare module "react" { + // allow CSS custom properties + interface CSSProperties { + [varName: `--${string}`]: string | number | undefined; + } +} diff --git a/packages/ui/package.json b/packages/ui/package.json index 5c86dcc..5840cfa 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -34,6 +34,7 @@ "dependencies": { "@floating-ui/react": "^0.26.25", "@hookform/resolvers": "^3.9.0", + "@manifold/types": "*", "@manifold/validators": "*", "@radix-ui/react-avatar": "^1.1.1", "@radix-ui/react-checkbox": "^1.1.2", diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts new file mode 100644 index 0000000..a2f8c94 --- /dev/null +++ b/packages/ui/src/index.ts @@ -0,0 +1 @@ +import "@manifold/types/react";