Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.d.ts 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import {
  2. Component,
  3. AsyncComponent,
  4. ComponentOptions,
  5. FunctionalComponentOptions,
  6. WatchOptionsWithHandler,
  7. WatchHandler,
  8. DirectiveOptions,
  9. DirectiveFunction,
  10. RecordPropsDefinition,
  11. ThisTypedComponentOptionsWithArrayProps,
  12. ThisTypedComponentOptionsWithRecordProps,
  13. WatchOptions,
  14. } from "./options";
  15. import { VNode, VNodeData, VNodeChildren, ScopedSlot } from "./vnode";
  16. import { PluginFunction, PluginObject } from "./plugin";
  17. export interface CreateElement {
  18. (tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), children?: VNodeChildren): VNode;
  19. (tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), data?: VNodeData, children?: VNodeChildren): VNode;
  20. }
  21. export interface Vue {
  22. readonly $el: HTMLElement;
  23. readonly $options: ComponentOptions<Vue>;
  24. readonly $parent: Vue;
  25. readonly $root: Vue;
  26. readonly $children: Vue[];
  27. readonly $refs: { [key: string]: Vue | Element | Vue[] | Element[] };
  28. readonly $slots: { [key: string]: VNode[] };
  29. readonly $scopedSlots: { [key: string]: ScopedSlot };
  30. readonly $isServer: boolean;
  31. readonly $data: Record<string, any>;
  32. readonly $props: Record<string, any>;
  33. readonly $ssrContext: any;
  34. readonly $vnode: VNode;
  35. readonly $attrs: Record<string, string>;
  36. readonly $listeners: Record<string, Function | Function[]>;
  37. $mount(elementOrSelector?: Element | string, hydrating?: boolean): this;
  38. $forceUpdate(): void;
  39. $destroy(): void;
  40. $set: typeof Vue.set;
  41. $delete: typeof Vue.delete;
  42. $watch(
  43. expOrFn: string,
  44. callback: (this: this, n: any, o: any) => void,
  45. options?: WatchOptions
  46. ): (() => void);
  47. $watch<T>(
  48. expOrFn: (this: this) => T,
  49. callback: (this: this, n: T, o: T) => void,
  50. options?: WatchOptions
  51. ): (() => void);
  52. $on(event: string | string[], callback: Function): this;
  53. $once(event: string, callback: Function): this;
  54. $off(event?: string | string[], callback?: Function): this;
  55. $emit(event: string, ...args: any[]): this;
  56. $nextTick(callback: (this: this) => void): void;
  57. $nextTick(): Promise<void>;
  58. $createElement: CreateElement;
  59. }
  60. export type CombinedVueInstance<Instance extends Vue, Data, Methods, Computed, Props> = Data & Methods & Computed & Props & Instance;
  61. export type ExtendedVue<Instance extends Vue, Data, Methods, Computed, Props> = VueConstructor<CombinedVueInstance<Instance, Data, Methods, Computed, Props> & Vue>;
  62. export interface VueConfiguration {
  63. silent: boolean;
  64. optionMergeStrategies: any;
  65. devtools: boolean;
  66. productionTip: boolean;
  67. performance: boolean;
  68. errorHandler(err: Error, vm: Vue, info: string): void;
  69. warnHandler(msg: string, vm: Vue, trace: string): void;
  70. ignoredElements: (string | RegExp)[];
  71. keyCodes: { [key: string]: number | number[] };
  72. }
  73. export interface VueConstructor<V extends Vue = Vue> {
  74. new <Data = object, Methods = object, Computed = object, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): CombinedVueInstance<V, Data, Methods, Computed, Record<PropNames, any>>;
  75. // ideally, the return type should just contains Props, not Record<keyof Props, any>. But TS requires Base constructors must all have the same return type.
  76. new <Data = object, Methods = object, Computed = object, Props = object>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): CombinedVueInstance<V, Data, Methods, Computed, Record<keyof Props, any>>;
  77. new (options?: ComponentOptions<V>): CombinedVueInstance<V, object, object, object, Record<keyof object, any>>;
  78. extend<Data, Methods, Computed, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
  79. extend<Data, Methods, Computed, Props>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
  80. extend<PropNames extends string = never>(definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
  81. extend<Props>(definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
  82. extend(options?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
  83. nextTick(callback: () => void, context?: any[]): void;
  84. nextTick(): Promise<void>
  85. set<T>(object: object, key: string, value: T): T;
  86. set<T>(array: T[], key: number, value: T): T;
  87. delete(object: object, key: string): void;
  88. delete<T>(array: T[], key: number): void;
  89. directive(
  90. id: string,
  91. definition?: DirectiveOptions | DirectiveFunction
  92. ): DirectiveOptions;
  93. filter(id: string, definition?: Function): Function;
  94. component(id: string): VueConstructor;
  95. component<VC extends VueConstructor>(id: string, constructor: VC): VC;
  96. component<Data, Methods, Computed, Props>(id: string, definition: AsyncComponent<Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
  97. component<Data, Methods, Computed, PropNames extends string = never>(id: string, definition?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
  98. component<Data, Methods, Computed, Props>(id: string, definition?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
  99. component<PropNames extends string>(id: string, definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
  100. component<Props>(id: string, definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
  101. component(id: string, definition?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
  102. use<T>(plugin: PluginObject<T> | PluginFunction<T>, options?: T): void;
  103. use(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): void;
  104. mixin(mixin: VueConstructor | ComponentOptions<Vue>): void;
  105. compile(template: string): {
  106. render(createElement: typeof Vue.prototype.$createElement): VNode;
  107. staticRenderFns: (() => VNode)[];
  108. };
  109. config: VueConfiguration;
  110. }
  111. export const Vue: VueConstructor;