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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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, NormalizedScopedSlot } 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: Element;
  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[] | undefined };
  29. readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined };
  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 | 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. async: boolean;
  73. }
  74. export interface VueConstructor<V extends Vue = Vue> {
  75. 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>>;
  76. // ideally, the return type should just contain Props, not Record<keyof Props, any>. But TS requires to have Base constructors with the same return type.
  77. 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>>;
  78. new (options?: ComponentOptions<V>): CombinedVueInstance<V, object, object, object, Record<keyof object, any>>;
  79. extend<Data, Methods, Computed, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
  80. extend<Data, Methods, Computed, Props>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
  81. extend<PropNames extends string = never>(definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
  82. extend<Props>(definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
  83. extend(options?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
  84. nextTick<T>(callback: (this: T) => void, context?: T): void;
  85. nextTick(): Promise<void>
  86. set<T>(object: object, key: string | number, value: T): T;
  87. set<T>(array: T[], key: number, value: T): T;
  88. delete(object: object, key: string | number): void;
  89. delete<T>(array: T[], key: number): void;
  90. directive(
  91. id: string,
  92. definition?: DirectiveOptions | DirectiveFunction
  93. ): DirectiveOptions;
  94. filter(id: string, definition?: Function): Function;
  95. component(id: string): VueConstructor;
  96. component<VC extends VueConstructor>(id: string, constructor: VC): VC;
  97. component<Data, Methods, Computed, Props>(id: string, definition: AsyncComponent<Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
  98. 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>>;
  99. component<Data, Methods, Computed, Props>(id: string, definition?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
  100. component<PropNames extends string>(id: string, definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
  101. component<Props>(id: string, definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
  102. component(id: string, definition?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
  103. use<T>(plugin: PluginObject<T> | PluginFunction<T>, options?: T): VueConstructor<V>;
  104. use(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<V>;
  105. mixin(mixin: VueConstructor | ComponentOptions<Vue>): VueConstructor<V>;
  106. compile(template: string): {
  107. render(createElement: typeof Vue.prototype.$createElement): VNode;
  108. staticRenderFns: (() => VNode)[];
  109. };
  110. observable<T>(obj: T): T;
  111. config: VueConfiguration;
  112. version: string;
  113. }
  114. export const Vue: VueConstructor;