Skip to content

Commit cb99a23

Browse files
committed
Enhance global type declarations in global.d.ts for improved TypeScript compatibility and add missing module interfaces
1 parent 83f33e4 commit cb99a23

File tree

1 file changed

+91
-13
lines changed

1 file changed

+91
-13
lines changed

src/types/global.d.ts

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// Type declarations for CSS modules and side-effect imports
1+
// Global type declarations for better TypeScript compatibility
2+
3+
// CSS modules and side-effect imports
24
declare module "*.css" {
35
const content: any;
46
export default content;
@@ -9,22 +11,38 @@ declare module "*.module.css" {
911
export default classes;
1012
}
1113

12-
// Allow importing CSS files as side effects
13-
declare module "*.css" {
14-
const content: any;
15-
export = content;
14+
// JSON modules
15+
declare module "*.json" {
16+
const value: any;
17+
export default value;
1618
}
1719

18-
// Docusaurus module declarations
20+
// JSX namespace declaration
21+
declare namespace JSX {
22+
interface Element extends React.ReactElement<any, any> {}
23+
interface IntrinsicElements {
24+
[elemName: string]: any;
25+
}
26+
}
27+
28+
// Docusaurus theme-common module
1929
declare module "@docusaurus/theme-common" {
2030
export function useColorMode(): {
2131
colorMode: "light" | "dark";
2232
setColorMode: (mode: "light" | "dark") => void;
2333
};
24-
// Add other exports as needed
25-
export * from "@docusaurus/theme-common/lib/utils/useColorMode";
34+
35+
export function useThemeConfig(): any;
36+
export function usePluralForm(): any;
37+
export function isMultiColumnFooterLinks(): any;
38+
export const ThemeClassNames: any;
39+
export const ErrorCauseBoundary: any;
40+
41+
// Export all other members as any
42+
export const [key: string]: any;
2643
}
2744

45+
// Other Docusaurus modules
2846
declare module "@docusaurus/useDocusaurusContext" {
2947
export default function useDocusaurusContext(): {
3048
siteConfig: {
@@ -46,6 +64,14 @@ declare module "@theme/Layout" {
4664
export default Layout;
4765
}
4866

67+
declare module "@theme/Footer" {
68+
export interface Props {
69+
[key: string]: any;
70+
}
71+
const Footer: React.FC<Props>;
72+
export default Footer;
73+
}
74+
4975
declare module "@docusaurus/Head" {
5076
import { ReactNode } from "react";
5177
interface HeadProps {
@@ -56,14 +82,66 @@ declare module "@docusaurus/Head" {
5682
export default Head;
5783
}
5884

59-
// JSON module declarations
60-
declare module "*.json" {
61-
const value: any;
62-
export default value;
85+
// Site-specific modules - using wildcard pattern for flexibility
86+
declare module "@site/src/lib/statsProvider" {
87+
export function useCommunityStatsContext(): any;
88+
export const CommunityStatsProvider: any;
89+
export const [key: string]: any;
90+
}
91+
92+
declare module "@site/src/lib/utils" {
93+
export function cn(...args: any[]): string;
94+
export const [key: string]: any;
95+
}
96+
97+
declare module "@site/src/utils/jsUtils" {
98+
export function sortBy(array: any[], key: string): any[];
99+
export const [key: string]: any;
100+
}
101+
102+
declare module "@site/src/services/github" {
103+
export const githubService: any;
104+
export interface GitHubDiscussion {
105+
[key: string]: any;
106+
}
107+
export const [key: string]: any;
108+
}
109+
110+
declare module "@site/src/components/ui/button" {
111+
export const Button: any;
112+
export const [key: string]: any;
113+
}
114+
115+
declare module "@site/src/database/sponsors" {
116+
export interface Sponsor {
117+
[key: string]: any;
118+
}
119+
export const [key: string]: any;
120+
}
121+
122+
declare module "@site/src/data/users" {
123+
export interface Tag {
124+
[key: string]: any;
125+
}
126+
export interface TagList {
127+
[key: string]: any;
128+
}
129+
export interface Tags {
130+
[key: string]: any;
131+
}
132+
export interface TagType {
133+
[key: string]: any;
134+
}
135+
export interface User {
136+
[key: string]: any;
137+
}
138+
export const sortedUsers: any;
139+
export const [key: string]: any;
63140
}
64141

65-
// Allow any for missing modules
142+
// Catch-all for any missing modules
66143
declare module "*" {
67144
const content: any;
68145
export default content;
146+
export const [key: string]: any;
69147
}

0 commit comments

Comments
 (0)