Skip to content

Commit

Permalink
Move global type declarations to types package
Browse files Browse the repository at this point in the history
  • Loading branch information
solomonhawk committed Oct 26, 2024
1 parent 379a16e commit a65bdc8
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "@manifold/types";
import "@manifold/ui/globals.css";

import { StrictMode } from "react";
Expand Down
1 change: 0 additions & 1 deletion apps/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `@manifold/types`
15 changes: 15 additions & 0 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./auth.d.ts";
export * from "./react.d.ts";
6 changes: 6 additions & 0 deletions packages/types/src/react.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export declare module "react" {
// allow CSS custom properties
interface CSSProperties {
[varName: `--${string}`]: string | number | undefined;
}
}
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "@manifold/types/react";

0 comments on commit a65bdc8

Please sign in to comment.