diff --git a/packages/twoslash-vue/test/results/renderer/example.raw.html b/packages/twoslash-vue/test/results/renderer/example.raw.html index 2095a16..0e85947 100644 --- a/packages/twoslash-vue/test/results/renderer/example.raw.html +++ b/packages/twoslash-vue/test/results/renderer/example.raw.html @@ -4,11 +4,8 @@
/* __placeholder__ */
 
-import { function ref<T>(value: T): Ref<UnwrapRef<T>> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which -has a single property `.value` that points to the inner value.
@paramvalue - The object to wrap in the ref.@see{@link https://vuejs.org/api/reactivity-core.html#ref}
ref
,
const computed: { - <T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions | undefined): ComputedRef<T>; - <T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions | undefined): WritableComputedRef<...>; -}
computed
} from 'vue'
+import { function ref<T>(value: T): Ref<UnwrapRef<T>> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which +has a single property `.value` that points to the inner value.
@paramvalue - The object to wrap in the ref.@see{@link https://vuejs.org/api/reactivity-core.html#ref}
ref
,
const computed: {
<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions | undefined): ComputedRef<T>;
<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions | undefined): WritableComputedRef<...>;
}
computed
} from 'vue'
@@ -18,11 +15,7 @@ export default await (async () => { -const { const defineProps: { - <PropNames extends string = string>(props: PropNames[]): { [K in keyof Readonly<{ [key in PropNames]?: any; }>]: Readonly<{ [key in PropNames]?: any; }>[K]; }; - <PP extends ComponentObjectPropsOptions<...> = ComponentObjectPropsOptions<...>>(props: PP): { [K in keyof Readonly<...>]: Readonly<...>[K]; }; - <TypeProps>(): DefineProps<...>; -}
Vue `<script setup>` compiler macro for declaring component props. The +const { const defineProps: {
<PropNames extends string = string>(props: PropNames[]): { [K in keyof Readonly<{ [key in PropNames]?: any; }>]: Readonly<{ [key in PropNames]?: any; }>[K]; };
<PP extends ComponentObjectPropsOptions<...> = ComponentObjectPropsOptions<...>>(props: PP): { [K in keyof Readonly<...>]: Readonly<...>[K]; };
<TypeProps>(): DefineProps<...>;
}
Vue `<script setup>` compiler macro for declaring component props. The expected argument is the same as the component `props` option. Example runtime declaration: @@ -46,11 +39,7 @@ foo?: string bar: number }>() -```
defineProps
, const defineSlots: <S extends Record<string, any> = Record<string, any>>() => Readonly<S & {}> & SdefineSlots, const defineEmits: { - <EE extends string = string>(emitOptions: EE[]): (event: EE, ...args: any[]) => void; - <E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E, keyof E>; - <T extends Record<...> | ((...args: any[]) => any)>(): T extends (...args: any[]) => any ? T : UnionToIntersection<...>; -}
Vue `<script setup>` compiler macro for declaring a component's emitted +```
defineProps
, const defineSlots: <S extends Record<string, any> = Record<string, any>>() => Readonly<S & {}> & SdefineSlots, const defineEmits: {
<EE extends string = string>(emitOptions: EE[]): (event: EE, ...args: any[]) => void;
<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E, keyof E>;
<T extends Record<...> | ((...args: any[]) => any)>(): T extends (...args: any[]) => any ? T : UnionToIntersection<...>;
}
Vue `<script setup>` compiler macro for declaring a component's emitted events. The expected argument is the same as the component `emits` option. Example runtime declaration: @@ -71,7 +60,7 @@ ``` This is only usable inside `<script setup>`, is compiled away in the -output and should **not** be actually called at runtime.
defineEmits
, const defineExpose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed | undefined) => void
Vue `<script setup>` compiler macro for declaring a component's exposed +output and should **not** be actually called at runtime.
defineEmits
, const defineExpose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed | undefined) => void
Vue `<script setup>` compiler macro for declaring a component's exposed instance properties when it is accessed by a parent component via template refs. @@ -80,22 +69,7 @@ via `defineExpose`. This is only usable inside `<script setup>`, is compiled away in the -output and should **not** be actually called at runtime.
defineExpose
, const defineModel: { - <T, M extends string | number | symbol = string>(options: { - required: true; - } & PropOptions<T, T> & DefineModelOptions<T>): ModelRef<T, M>; - <T, M extends string | ... 1 more ... | symbol = string>(options: { - ...; - } & ... 1 more ... & DefineModelOptions<...>): ModelRef<...>; - <T, M extends string | ... 1 more ... | symbol = string>(options?: (PropOptions<...> & DefineModelOptions<...>) | undefined): ModelRef<...>; - <T, M extends string | ... 1 more ... | symbol = string>(name: string, options: { - ...; - } & ... 1 more ... & DefineModelOptions<...>): ModelRef<...>; - <T, M extends string | ... 1 more ... | symbol = string>(name: string, options: { - ...; - } & ... 1 more ... & DefineModelOptions<...>): ModelRef<...>; - <T, M extends string | ... 1 more ... | symbol = string>(name: string, options?: (PropOptions<...> & DefineModelOptions<...>) | undefined): ModelRef<...>; -}
Vue `<script setup>` compiler macro for declaring a +output and should **not** be actually called at runtime.
defineExpose
, const defineModel: {
<T, M extends string | number | symbol = string>(options: {
required: true;
} & PropOptions<T, T> & DefineModelOptions<T>): ModelRef<T, M>;
<T, M extends string | ... 1 more ... | symbol = string>(options: {
...;
} & ... 1 more ... & DefineModelOptions<...>): ModelRef<...>;
<T, M extends string | ... 1 more ... | symbol = string>(options?: (PropOptions<...> & DefineModelOptions<...>) | undefined): ModelRef<...>;
<T, M extends string | ... 1 more ... | symbol = string>(name: string, options: {
...;
} & ... 1 more ... & DefineModelOptions<...>): ModelRef<...>;
<T, M extends string | ... 1 more ... | symbol = string>(name: string, options: {
...;
} & ... 1 more ... & DefineModelOptions<...>): ModelRef<...>;
<T, M extends string | ... 1 more ... | symbol = string>(name: string, options?: (PropOptions<...> & DefineModelOptions<...>) | undefined): ModelRef<...>;
}
Vue `<script setup>` compiler macro for declaring a two-way binding prop that can be consumed via `v-model` from the parent component. This will declare a prop with the same name and a corresponding `update:propName` event. @@ -104,15 +78,13 @@ Otherwise the prop name will default to "modelValue". In both cases, you can also pass an additional object which will be used as the prop's options. -The the returned ref behaves differently depending on whether the parent +The returned ref behaves differently depending on whether the parent provided the corresponding v-model props or not: - If yes, the returned ref's value will always be in sync with the parent prop. -- If not, the returned ref will behave like a normal local ref.
defineModel
, const defineOptions: <RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: (ComponentOptionsBase<...> & ... 2 more ... & { - ...; -}) | undefined) => void
Vue `<script setup>` compiler macro for declaring a component's additional +- If not, the returned ref will behave like a normal local ref.
defineModel
, const defineOptions: <RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: (ComponentOptionsBase<...> & ... 2 more ... & {
...;
}) | undefined) => void
Vue `<script setup>` compiler macro for declaring a component's additional options. This should be used only for options that cannot be expressed via -Composition API - e.g. `inheritAttrs`.
defineOptions
, const withDefaults: <T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults) => PropsWithDefaults<T, Defaults, BKeys>
Vue `<script setup>` compiler macro for providing props default values when +Composition API - e.g. `inheritAttrs`.
defineOptions
, const withDefaults: <T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults) => PropsWithDefaults<T, Defaults, BKeys>
Vue `<script setup>` compiler macro for providing props default values when using type-based `defineProps` declaration. Example usage: @@ -128,10 +100,10 @@ This is only usable inside `<script setup>`, is compiled away in the output and should **not** be actually called at runtime.
withDefaults
, } = await import('vue');
-const const count: Ref<number>count = ref<number>(value: number): Ref<number> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which +const const count: Ref<number>count = ref<number>(value: number): Ref<number> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which has a single property `.value` that points to the inner value.
@paramvalue - The object to wrap in the ref.@see{@link https://vuejs.org/api/reactivity-core.html#ref}
ref
(0)
-const
const double: ComputedRef<number>
double
= computed<number>(getter: ComputedGetter<number>, debugOptions?: DebuggerOptions | undefined): ComputedRef<number> (+1 overload)
Takes a getter function and returns a readonly reactive ref object for the +const
const double: ComputedRef<number>
double
= computed<number>(getter: ComputedGetter<number>, debugOptions?: DebuggerOptions | undefined): ComputedRef<number> (+1 overload)
Takes a getter function and returns a readonly reactive ref object for the returned value from the getter. It can also take an object with get and set functions to create a writable ref object.
@example```js // Creating a readonly computed ref: @@ -154,19 +126,19 @@ plusOne.value = 1 console.log(count.value) // 0 -```@paramgetter - Function that produces the next value.@paramdebugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.@see{@link https://vuejs.org/api/reactivity-core.html#computed}
computed
(() => const count: Ref<number>count.Ref<number>.value: numbervalue * 2)
+```@paramgetter - Function that produces the next value.@paramdebugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.@see{@link https://vuejs.org/api/reactivity-core.html#computed}
computed
(() => const count: Ref<number>count.Ref<number>.value: numbervalue * 2)
const __VLS_componentsOption = {}; -const __VLS_name = 'HelloWorld' as type const = "HelloWorld"const; +const __VLS_name = 'HelloWorld' as type const = "HelloWorld"const; function __VLS_template() { -let __VLS_ctx!: type InstanceType<T extends abstract new (...args: any) => any> = T extends abstract new (...args: any) => infer R ? R : any
Obtain the return type of a constructor function type
InstanceType
<__VLS_PickNotAny<typeof __VLS_internalComponent, new () => {}>> & {
+let __VLS_ctx!: type InstanceType<T extends abstract new (...args: any) => any> = T extends abstract new (...args: any) => infer R ? R : any
Obtain the return type of a constructor function type
InstanceType
<__VLS_PickNotAny<typeof __VLS_internalComponent, new () => {}>> & {
}; /* Components */ -let __VLS_otherComponents!: type NonNullable<T> = T & {}
Exclude null and undefined from T
NonNullable
<typeof __VLS_internalComponent extends { components: Ccomponents: infer function (type parameter) CC } ? function (type parameter) CC : {}> & typeof __VLS_componentsOption;
-let __VLS_own!: __VLS_SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & (new () => { $slots: {}$slots: typeof __VLS_slots })>; -let __VLS_localComponents!: typeof __VLS_otherComponents & type Omit<T, K extends string | number | symbol> = { [P in Exclude<keyof T, K>]: T[P]; }
Construct a type with the properties of T except for those in type K.
Omit
<typeof __VLS_own, keyof typeof __VLS_otherComponents>;
+let __VLS_otherComponents!: type NonNullable<T> = T & {}
Exclude null and undefined from T
NonNullable
<typeof __VLS_internalComponent extends { components: Ccomponents: infer function (type parameter) CC } ? function (type parameter) CC : {}> & typeof __VLS_componentsOption;
+let __VLS_own!: __VLS_SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & (new () => { $slots: {}$slots: typeof __VLS_slots })>; +let __VLS_localComponents!: typeof __VLS_otherComponents & type Omit<T, K extends string | number | symbol> = { [P in Exclude<keyof T, K>]: T[P]; }
Construct a type with the properties of T except for those in type K.
Omit
<typeof __VLS_own, keyof typeof __VLS_otherComponents>;
let __VLS_components!: typeof __VLS_localComponents & __VLS_GlobalComponents & typeof __VLS_ctx; /* Style Scoped */ type __VLS_StyleScopedClasses = {}; @@ -175,97 +147,67 @@ /* CSS variable injection end */ let __VLS_resolvedLocalAndGlobalComponents!: {} ; -__VLS_intrinsicElements.button: ButtonHTMLAttributes & ReservedPropsbutton;__VLS_intrinsicElements.button: ButtonHTMLAttributes & ReservedPropsbutton; +__VLS_intrinsicElements.button: ButtonHTMLAttributes & ReservedPropsbutton;__VLS_intrinsicElements.button: ButtonHTMLAttributes & ReservedPropsbutton; { const __VLS_0 = __VLS_intrinsicElements["button"]; const __VLS_1 = __VLS_elementAsFunctionalComponent(__VLS_0); -const __VLS_2 = __VLS_1({ ...{ onClick?: ((payload: MouseEvent) => void) | undefinedonClick: {} as any, }, }, ...__VLS_functionalComponentArgsRest(__VLS_1)); -({} as (props: ButtonHTMLAttributes & ReservedProps & Record<string, unknown>props: __VLS_FunctionalComponentProps<typeof __VLS_0, typeof __VLS_2> & type Record<K extends string | number | symbol, T> = { [P in K]: T; }
Construct a type with a set of properties K of type T
Record
<string, unknown>) => void)({ ...{ onClick?: ((payload: MouseEvent) => void) | undefinedonClick: {} as any, }, });
+const __VLS_2 = __VLS_1({ ...{ onClick?: ((payload: MouseEvent) => void) | undefinedonClick: {} as any, }, }, ...__VLS_functionalComponentArgsRest(__VLS_1)); +({} as (props: ButtonHTMLAttributes & ReservedProps & Record<string, unknown>props: __VLS_FunctionalComponentProps<typeof __VLS_0, typeof __VLS_2> & type Record<K extends string | number | symbol, T> = { [P in K]: T; }
Construct a type with a set of properties K of type T
Record
<string, unknown>) => void)({ ...{ onClick?: ((payload: MouseEvent) => void) | undefinedonClick: {} as any, }, });
const __VLS_3 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2)!; -let __VLS_4!: __VLS_NormalizeEmits<typeof __VLS_3.emit?: anyemit>; -let __VLS_5 = { 'click': __VLS_pickEvent(__VLS_4['click'], ({} as __VLS_FunctionalComponentProps<typeof __VLS_1, typeof __VLS_2>).
onClick?: ((payload: MouseEvent) => void) | undefined
onClick
) };
-__VLS_5 = { 'click': ((payload: MouseEvent) => void) | undefinedclick: $event: MouseEvent$event => { -__VLS_ctx.count: numbercount++; +let __VLS_4!: __VLS_NormalizeEmits<typeof __VLS_3.emit?: anyemit>; +let __VLS_5 = { 'click': __VLS_pickEvent(__VLS_4['click'], ({} as __VLS_FunctionalComponentProps<typeof __VLS_1, typeof __VLS_2>).
onClick?: ((payload: MouseEvent) => void) | undefined
onClick
) };
+__VLS_5 = { 'click': ((payload: MouseEvent) => void) | undefinedclick: $event: MouseEvent$event => { +__VLS_ctx.count: numbercount++; // @ts-ignore -[const count: Ref<number>count,]; +[const count: Ref<number>count,]; } }; -( __VLS_ctx.msg: stringmsg ); -( __VLS_ctx.count: numbercount ); -(__VLS_3.slots?: anyslots!).default; +( __VLS_ctx.msg: stringmsg ); +( __VLS_ctx.count: numbercount ); +(__VLS_3.slots?: anyslots!).default; } -if (typeof __VLS_styleScopedClasses === 'object' && !var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(__VLS_styleScopedClasses)) { +if (typeof __VLS_styleScopedClasses === 'object' && !var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(__VLS_styleScopedClasses)) { } var __VLS_slots!:{ }; // @ts-ignore -[msg,const count: Ref<number>count,]; +[msg,const count: Ref<number>count,]; return __VLS_slots; } -const __VLS_internalComponent = (await import('vue')).function defineComponent<{}, { - count: Ref<number>; -}, { - msg: string; -}, {}, { - greet(): void; -}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string>(options: ComponentOptionsWithoutProps<...>): DefineComponent<...> (+4 overloads)defineComponent({ -ComponentOptionsBase<{}, { count: Ref<number>; }, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, ... 4 more ..., {}>.setup?: ((this: void, props: LooseRequired<{} & {}>, ctx: { - attrs: Data; - slots: Readonly<InternalSlots>; - emit: (event: string, ...args: any[]) => void; - expose: (exposed?: Record<...> | undefined) => void; -}) => void | ... 2 more ... | Promise<...>) | undefinedsetup() { +const __VLS_internalComponent = (await import('vue')).function defineComponent<{}, {
count: Ref<number>;
}, {
msg: string;
}, {}, {
greet(): void;
}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string>(options: ComponentOptionsWithoutProps<...>): DefineComponent<...> (+4 overloads)
defineComponent
({
+ComponentOptionsBase<{}, { count: Ref<number>; }, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, ... 4 more ..., {}>.setup?: ((this: void, props: LooseRequired<{} & {}>, ctx: {
attrs: Data;
slots: Readonly<InternalSlots>;
emit: (event: string, ...args: any[]) => void;
expose: (exposed?: Record<...> | undefined) => void;
}) => void | ... 2 more ... | Promise<...>) | undefined
setup
() {
return { -count: Ref<number>count: const count: Ref<number>count as typeof const count: Ref<number>count, +count: Ref<number>count: const count: Ref<number>count as typeof const count: Ref<number>count, }; }, - ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType<...> = {}>.name?: string | undefinedname: 'HelloWorld', - LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.data?: ((this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<{}, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, ... 8 more ..., {}>) => { - ...; -}) | undefineddata() { + ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType<...> = {}>.name?: string | undefinedname: 'HelloWorld', + LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.data?: ((this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<{}, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, ... 8 more ..., {}>) => {
...;
}) | undefined
data
() {
return { - msg: stringmsg: 'Hello!' + msg: stringmsg: 'Hello!' } }, - LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.methods?: { - greet(): void; -} | undefinedmethods: { - function greet(): voidgreet() { - var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
(this.msg: stringmsg)
+ LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.methods?: {
greet(): void;
} | undefined
methods
: {
+ function greet(): voidgreet() { + var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
(this.msg: stringmsg)
} } }); -return (await import('vue')).function defineComponent<{}, {}, { - msg: string; -}, {}, { - greet(): void; -}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string>(options: ComponentOptionsWithoutProps<{}, {}, { - msg: string; -}, ... 9 more ..., {}>): DefineComponent<...> (+4 overloads)defineComponent({ -ComponentOptionsBase<{}, {}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}>.setup?: ((this: void, props: LooseRequired<{} & {}>, ctx: { - attrs: Data; - slots: Readonly<InternalSlots>; - emit: (event: string, ...args: any[]) => void; - expose: (exposed?: Record<...> | undefined) => void; -}) => void | ... 2 more ... | Promise<...>) | undefinedsetup() { +return (await import('vue')).function defineComponent<{}, {}, {
msg: string;
}, {}, {
greet(): void;
}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string>(options: ComponentOptionsWithoutProps<{}, {}, {
msg: string;
}, ... 9 more ..., {}>): DefineComponent<...> (+4 overloads)
defineComponent
({
+ComponentOptionsBase<{}, {}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}>.setup?: ((this: void, props: LooseRequired<{} & {}>, ctx: {
attrs: Data;
slots: Readonly<InternalSlots>;
emit: (event: string, ...args: any[]) => void;
expose: (exposed?: Record<...> | undefined) => void;
}) => void | ... 2 more ... | Promise<...>) | undefined
setup
() {
return { }; }, - ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType<...> = {}>.name?: string | undefinedname: 'HelloWorld', - LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.data?: ((this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<{}, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, ... 8 more ..., {}>) => { - ...; -}) | undefineddata() { + ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType<...> = {}>.name?: string | undefinedname: 'HelloWorld', + LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.data?: ((this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<{}, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, ... 8 more ..., {}>) => {
...;
}) | undefined
data
() {
return { - msg: stringmsg: 'Hello!' + msg: stringmsg: 'Hello!' } }, - LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.methods?: { - greet(): void; -} | undefinedmethods: { - function greet(): voidgreet() { - var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
(this.msg: stringmsg)
+ LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.methods?: {
greet(): void;
} | undefined
methods
: {
+ function greet(): voidgreet() { + var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
(this.msg: stringmsg)
} } }); diff --git a/packages/twoslash-vue/test/results/renderer/example.vue.html b/packages/twoslash-vue/test/results/renderer/example.vue.html index 56f64aa..25a3233 100644 --- a/packages/twoslash-vue/test/results/renderer/example.vue.html +++ b/packages/twoslash-vue/test/results/renderer/example.vue.html @@ -3,20 +3,17 @@
<script setup lang="ts">
-import { function ref<T>(value: T): Ref<UnwrapRef<T>> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which -has a single property `.value` that points to the inner value.
@paramvalue - The object to wrap in the ref.@see{@link https://vuejs.org/api/reactivity-core.html#ref}
ref
,
const computed: { - <T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions | undefined): ComputedRef<T>; - <T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions | undefined): WritableComputedRef<...>; -}
computed
} from 'vue'
+import { function ref<T>(value: T): Ref<UnwrapRef<T>> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which +has a single property `.value` that points to the inner value.
@paramvalue - The object to wrap in the ref.@see{@link https://vuejs.org/api/reactivity-core.html#ref}
ref
,
const computed: {
<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions | undefined): ComputedRef<T>;
<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions | undefined): WritableComputedRef<...>;
}
computed
} from 'vue'
-const const count: Ref<number>count = ref<number>(value: number): Ref<number> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which +const const count: Ref<number>count = ref<number>(value: number): Ref<number> (+1 overload)
Takes an inner value and returns a reactive and mutable ref object, which has a single property `.value` that points to the inner value.
@paramvalue - The object to wrap in the ref.@see{@link https://vuejs.org/api/reactivity-core.html#ref}
ref
(0)
-const
const double: ComputedRef<number>
double
= computed<number>(getter: ComputedGetter<number>, debugOptions?: DebuggerOptions | undefined): ComputedRef<number> (+1 overload)
Takes a getter function and returns a readonly reactive ref object for the +const
const double: ComputedRef<number>
double
= computed<number>(getter: ComputedGetter<number>, debugOptions?: DebuggerOptions | undefined): ComputedRef<number> (+1 overload)
Takes a getter function and returns a readonly reactive ref object for the returned value from the getter. It can also take an object with get and set functions to create a writable ref object.
@example```js // Creating a readonly computed ref: @@ -39,30 +36,26 @@ plusOne.value = 1 console.log(count.value) // 0 -```@paramgetter - Function that produces the next value.@paramdebugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.@see{@link https://vuejs.org/api/reactivity-core.html#computed}
computed
(() => const count: Ref<number>count.Ref<number>.value: numbervalue * 2)
+```@paramgetter - Function that produces the next value.@paramdebugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.@see{@link https://vuejs.org/api/reactivity-core.html#computed}
computed
(() => const count: Ref<number>count.Ref<number>.value: numbervalue * 2)
</script> <script> export default { - ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType<...> = {}>.name?: string | undefinedname: 'HelloWorld', - LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.data?: ((this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<{}, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, ... 8 more ..., {}>) => { - ...; -}) | undefineddata() { + ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType<...> = {}>.name?: string | undefinedname: 'HelloWorld', + LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.data?: ((this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<{}, {}, {}, {}, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, ... 8 more ..., {}>) => {
...;
}) | undefined
data
() {
return { - msg: stringmsg: 'Hello!' + msg: stringmsg: 'Hello!' } }, - LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.methods?: { - greet(): void; -} | undefinedmethods: { - function greet(): voidgreet() { - var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
(this.msg: stringmsg)
+ LegacyOptions<{}, { msg: string; }, {}, { greet(): void; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string>.methods?: {
greet(): void;
} | undefined
methods
: {
+ function greet(): voidgreet() { + var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
(this.msg: stringmsg)
} } } </script> <template> - <button: ButtonHTMLAttributes & ReservedPropsbutton @
onClick?: ((payload: MouseEvent) => void) | undefined
click
="const count: Ref<number>count++">{{ msg: stringmsg }} Count is: {{ const count: Ref<number>count }}</button: ButtonHTMLAttributes & ReservedPropsbutton>
+ <button: ButtonHTMLAttributes & ReservedPropsbutton @
onClick?: ((payload: MouseEvent) => void) | undefined
click
="const count: Ref<number>count++">{{ msg: stringmsg }} Count is: {{ const count: Ref<number>count }}</button: ButtonHTMLAttributes & ReservedPropsbutton>
</template>
\ No newline at end of file