import { ComponentPublicInstance } from './componentProxy'
import { warn } from './warning'
+/**
+ * Interface for declaring custom options.
+ *
+ * @example
+ * ```ts
+ * declare module '@vue/runtime-core' {
+ * interface ComponentCustomOptions {
+ * beforeRouteUpdate?(
+ * to: Route,
+ * from: Route,
+ * next: () => void
+ * ): void
+ * }
+ * }
+ * ```
+ */
+export interface ComponentCustomOptions {}
+
export interface ComponentOptionsBase<
Props,
RawBindings,
M extends MethodOptions,
E extends EmitsOptions,
EE extends string = string
-> extends LegacyOptions<Props, D, C, M>, SFCInternalOptions {
+>
+ extends LegacyOptions<Props, D, C, M>,
+ SFCInternalOptions,
+ ComponentCustomOptions {
setup?: (
this: void,
props: Props,
export {
ComponentOptions,
ComponentOptionsWithoutProps,
- ComponentOptionsWithObjectProps as ComponentOptionsWithProps,
- ComponentOptionsWithArrayProps
+ ComponentOptionsWithObjectProps,
+ ComponentOptionsWithArrayProps,
+ ComponentCustomOptions
} from './componentOptions'
export {
ComponentPublicInstance,
-import { expectError } from 'tsd'
+import { expectError, expectType } from 'tsd'
import { defineComponent } from './index'
declare module '@vue/runtime-core' {
+ interface ComponentCustomOptions {
+ test?(n: number): void
+ }
+
interface ComponentCustomProperties {
state: 'stopped' | 'running'
}
export const Custom = defineComponent({
data: () => ({ counter: 0 }),
+
+ test(n) {
+ expectType<number>(n)
+ },
+
methods: {
aMethod() {
expectError(this.notExisting)