-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathglobal.d.ts
More file actions
21 lines (20 loc) · 885 Bytes
/
global.d.ts
File metadata and controls
21 lines (20 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import React from 'react';
// Global type declarations for React components
declare global {
// Just empty object
type EmptyObj = Record<string, unknown>;
// Any object
type AnyObj = Record<string, any>;
// Any function
export type AnyFn<RT = any> = (...args: any[]) => RT;
// Form action
export type AnyFormAction<RT = any> = (formData: FormData) => romise<[RT, null]>;
// React fn component with children
type FC<T = object> = React.FunctionComponent<React.PropsWithChildren<T>>;
// React fn component without children
type RC<T = object> = React.FunctionComponent<T>;
// Get available props from element (e.g. button, input, div, etc.)
type ComponentProps<T> = React.ComponentProps<T>;
// Note: PageProps is now globally provided by Next.js 16 in .next/types/routes.d.ts
// Usage: PageProps<'/blog/[slug]'> - pass the route path as type parameter
}