vue-vben-admin/types/global.d.ts

102 lines
2.5 KiB
TypeScript
Raw Permalink Normal View History

2021-03-26 22:22:58 +08:00
import type {
ComponentRenderProxy,
VNode,
VNodeChild,
2021-03-26 22:22:58 +08:00
ComponentPublicInstance,
FunctionalComponent,
PropType as VuePropType,
} from 'vue'
2021-03-26 22:22:58 +08:00
declare global {
2021-04-01 01:07:48 +08:00
const __APP_INFO__: {
2021-04-01 01:03:00 +08:00
pkg: {
name: string
version: string
dependencies: Recordable<string>
devDependencies: Recordable<string>
}
lastBuildTime: string
}
// declare interface Window {
// // Global vue app instance
// __APP__: App<Element>;
// }
2021-03-26 22:22:58 +08:00
// vue
declare type PropType<T> = VuePropType<T>
declare type VueNode = VNodeChild | JSX.Element
2021-03-26 22:22:58 +08:00
export type Writable<T> = {
-readonly [P in keyof T]: T[P]
}
2021-03-26 22:22:58 +08:00
declare type Nullable<T> = T | null
declare type NonNullable<T> = T extends null | undefined ? never : T
declare type Recordable<T = any> = Record<string, T>
2021-03-26 22:22:58 +08:00
declare type ReadonlyRecordable<T = any> = {
readonly [key: string]: T
}
2021-03-26 22:22:58 +08:00
declare type Indexable<T = any> = {
[key: string]: T
}
2021-03-26 22:22:58 +08:00
declare type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>
}
declare type TimeoutHandle = ReturnType<typeof setTimeout>
declare type IntervalHandle = ReturnType<typeof setInterval>
2021-03-26 22:22:58 +08:00
declare interface ChangeEvent extends Event {
target: HTMLInputElement
2021-03-26 22:22:58 +08:00
}
declare interface WheelEvent {
path?: EventTarget[]
2021-03-26 22:22:58 +08:00
}
interface ImportMetaEnv extends ViteEnv {
__: unknown
2021-03-26 22:22:58 +08:00
}
declare interface ViteEnv {
VITE_PORT: number
VITE_USE_MOCK: boolean
VITE_USE_PWA: boolean
VITE_PUBLIC_PATH: string
VITE_PROXY: [string, string][]
VITE_GLOB_APP_TITLE: string
VITE_GLOB_APP_SHORT_NAME: string
VITE_USE_CDN: boolean
VITE_DROP_CONSOLE: boolean
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
VITE_LEGACY: boolean
VITE_USE_IMAGEMIN: boolean
VITE_GENERATE_UI: string
2021-03-26 22:22:58 +08:00
}
declare function parseInt(s: string | number, radix?: number): number
2021-03-26 22:22:58 +08:00
declare function parseFloat(string: string | number): number
2021-03-26 22:22:58 +08:00
namespace JSX {
// tslint:disable no-empty-interface
type Element = VNode
2021-03-26 22:22:58 +08:00
// tslint:disable no-empty-interface
type ElementClass = ComponentRenderProxy
2021-03-26 22:22:58 +08:00
interface ElementAttributesProperty {
$props: any
2021-03-26 22:22:58 +08:00
}
interface IntrinsicElements {
[elem: string]: any
2021-03-26 22:22:58 +08:00
}
interface IntrinsicAttributes {
[elem: string]: any
2021-03-26 22:22:58 +08:00
}
}
2020-11-15 13:22:34 +08:00
}
2021-03-26 22:22:58 +08:00
declare module 'vue' {
export type JSXComponent<Props = any> =
| { new (): ComponentPublicInstance<Props> }
| FunctionalComponent<Props>
2021-03-23 23:03:29 +08:00
}