text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>import Vue from 'vue' describe('Options errorCaptured', () => { let globalSpy beforeEach(() => { globalSpy = Vue.config.errorHandler = vi.fn() }) afterEach(() => { Vue.config.errorHandler = undefined }) it('should capture error from child component', () => { const spy = vi.fn()...
fim
vuejs/vue
typescript
<|fim_suffix|>ect.prototype.watch', done => { Vue.mixin({}) const spy = vi.fn() const A = Vue.extend({ data: function () { return { a: 1 } }, watch: { a: spy }, created: function () { this.a = 2 } }) new Vue({ ...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { createEmptyVNode } from 'core/vdom/vnode' describe('Options functional', () => { it('should work', done => { const vm = new Vue({ data: { test: 'foo' }, template: '<div><wrap :msg="test">bar</wrap></div>', components: { wrap: { func...
fim
vuejs/vue
typescript
<|fim_suffix|>: false, template: `<div><div v-bind="$attrs"></div></div>` } } }).$mount() expect(vm.$el.children[0].id).toBe('foo') vm.foo = 'bar' waitForUpdate(() => { expect(vm.$el.children[0].id).toBe('bar') }).then(done) }) }) <|fim_prefix|>import Vue from 'vue' ...
fim
vuejs/vue
typescript
<|fim_suffix|>/child></div>`, data() { return { foo: {}, $foo: {}, foo1: [] } }, provide() { return { foo: this.foo, $foo: this.$foo, foo1: this.foo1, bar: {}, baz: [] } }, compo...
fim
vuejs/vue
typescript
<|fim_suffix|> describe('beforeDestroy', () => { it('should be called before destroy', () => { const vm = new Vue({ render() {}, beforeDestroy() { spy() expect(this._isBeingDestroyed).toBe(false) expect(this._isDestroyed).toBe(false) } }).$mount() ...
fim
vuejs/vue
typescript
<|fim_suffix|>ethod "_update" conflicts with an existing Vue instance method` ).toHaveBeenWarned() }) }) <|fim_prefix|>import Vue from 'vue' import testObjectOption from '../../../helpers/test-object-option' describe('Options methods', () => { testObjectOption('methods') it('should have correct context', ()...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { mergeOptions } from 'core/util/index' describe('Options mixins', () => { it('vm should have options from mixin', () => { const mixin = { directives: { c: {} }, methods: { a: function () {} } } const vm = new Vue({ ...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' describe('Options name', () => { it('should contain itself in self components', () => { const vm = Vue.extend({ name: 'SuperVue' }) <|fim_suffix|>d not override given name when using Vue.component', () => { const SuperComponent = Vue.component('super-compone...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' describe('Options parent', () => { it('should work', () => { const parent = new Vue({ render() {} }).$mount() const child = new Vue({ parent: parent, render() {} }).$mount() // this option is straight-forward // it should register 'paren...
fim
vuejs/vue
typescript
<|fim_suffix|>ld.a.__ob__).toBeUndefined() }).then(done) }) it('should not warn for non-required, absent prop', function () { new Vue({ template: '<test></test>', components: { test: { template: '<div></div>', props: { prop: { type: String ...
fim
vuejs/vue
typescript
<|fim_suffix|>' ).toHaveBeenWarned() }) }) <|fim_prefix|>import Vue from 'vue' describe('Options propsData', () => { it('should work', done => { const A = Vue.extend({ props: ['a'], template: '<div>{{ a }}</div>' }) const vm = new A({ propsData: { a: 123 } }).$mo...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' describe('Options render', () => { it('basic usage', () => { const vm = new Vue({ render(h) { const children: any[] = [] for (let i = 0; i < this.items.length; i++) { children.push(h('li', { staticClass: 'task' }, [this.items[i].name])) ...
fim
vuejs/vue
typescript
<|fim_suffix|>spy).toHaveBeenCalledWith(err, vm, 'renderError') }) }) <|fim_prefix|>import Vue from 'vue' describe('Options renderError', () => { it('should be used on render errors', done => { Vue.config.errorHandler = () => {} const vm = new Vue({ data: { ok: true }, render(h) {...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' describe('Options template', () => { let el beforeEach(() => { el = document.createElement('script') el.type = 'x-template' el.id = 'app' el.innerHTML = '<p>{{message}}</p>' document.body.appendChild(el) }) afterEach(() => { document.body.removeChild...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import testObjectOption from '../../../helpers/test-object-option' describe('Options watch', () => { let spy beforeEach(() => { spy = vi.fn() }) testObjectOption('watch') it('basic usage', done => { const vm = new Vue({ data: { a: 1 }, w...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' describe('ref', () => { type TestShape = { id: string template: string data?: any components?: any } type ComponentShape = { test: TestShape test2: TestShape test3: TestShape } const components: ComponentShape = { test: { id: 'test', ...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { defineAsyncComponent, h, ref, nextTick, defineComponent } from 'v3' import { Component } from 'types/component' const timeout = (n: number = 0) => new Promise(r => setTimeout(r, n)) const loadingComponent = defineComponent({ template: `<div>loading</div>` }) const resol...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { h, provide, inject, InjectionKey, ref, nextTick, Ref, readonly, reactive } from 'v3/index' // reference: https://vue-composition-api-rfc.netlify.com/api.html#provide-inject describe('api: provide/inject', () => { it('string keys', () => { const Provi...
fim
vuejs/vue
typescript
<|fim_suffix|>ops: any) { onBeforeMount(() => calls.push('mid onBeforeMount')) onMounted(() => calls.push('mid onMounted')) onBeforeUpdate(() => calls.push('mid onBeforeUpdate')) onUpdated(() => calls.push('mid onUpdated')) onBeforeUnmount(() => calls.push('mid onBeforeUnmount'))...
fim
vuejs/vue
typescript
<|fim_suffix|> return h => h(Child, { props: { msg } }) } }).$mount() }) it('should not track dep accessed in setup', async () => { const spy = vi.fn() const msg = ref('hi') const Child = { setup: () => { msg.value return () => {} } } new Vue({ ...
fim
vuejs/vue
typescript
<|fim_suffix|> } } const Parent = { render() { return h(Child, { props: { a: a.value } }) } } const root = document.createElement('div') new Vue(Parent).$mount(root) a.value++ await nextTick() expect(updated).toHaveBeenCalledTimes(1) expect(cb).toHaveBeenCa...
fim
vuejs/vue
typescript
<|fim_prefix|>import { computed, reactive, ref, isReadonly, WritableComputedRef, DebuggerEvent, TrackOpTypes, TriggerOpTypes } from 'v3' import { effect } from 'v3/reactivity/effect' import { nextTick } from 'core/util' import { set, del } from 'core/observer/index' describe('reactivity/computed', () =...
fim
vuejs/vue
typescript
import Vue from 'vue' import { nextTick } from 'core/util' import { watch, watchEffect, reactive, computed, ref, ComputedRef, EffectScope, onScopeDispose, getCurrentScope } from 'v3/index' import { effect } from 'v3/reactivity/effect' describe('reactivity/effectScope', () => { it('should run', () =...
fim
vuejs/vue
typescript
<|fim_prefix|>import { ref, isRef, reactive, isReactive, toRaw, markRaw, computed } from 'v3' import { set } from 'core/observer' import { effect } from 'v3/reactivity/effect' describe('reactivity/reactive', () => { test('Object', () => { const original = { foo: 1 } const observed = reactive(original) //...
fim
vuejs/vue
typescript
<|fim_prefix|>import { reactive, readonly, toRaw, isReactive, isReadonly, markRaw, ref, isProxy } from 'v3' import { effect } from 'v3/reactivity/effect' import { set, del } from 'core/observer' /** * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html */ type Writable...
fim
vuejs/vue
typescript
<|fim_suffix|>m.value }) expect(dummy).toBe(1) custom.value = 2 // should not trigger yet expect(dummy).toBe(1) _trigger!() expect(dummy).toBe(2) }) test('should not trigger when setting value to same proxy', () => { const obj = reactive({ count: 0 }) const a = ref(obj) c...
fim
vuejs/vue
typescript
<|fim_suffix|>est('should be reactive', () => { // const shallowArray = shallowReactive<unknown[]>([]) // const a = {} // let size // effect(() => { // size = shallowArray.length // }) // expect(size).toBe(0) // shallowArray.push(a) // expect(size).toBe(1) /...
fim
vuejs/vue
typescript
<|fim_suffix|> not make the value generated by the iterable method readonly', () => { // const val = { foo: 1 } // const original = new Set([val]) // const sroSet = shallowReadonly(original) // const values1 = [...sroSet.values()] // const values2 = [...sroSet.entries()] // expect(...
fim
vuejs/vue
typescript
<|fim_suffix|> } new Vue(Comp).$mount() expect(spy).toHaveBeenCalledWith('DIV') }) it('should work with direct reactive property', () => { const state = reactive({ refKey: null }) const Comp = { setup() { return state }, render() { return h('div', { ...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vu<|fim_suffix|> = getApp(state) const vm = new Vue(App).$mount() await nextTick() expect((vm.$el as HTMLElement).style.getPropertyValue(`--color`)).toBe( `red` ) state.color = 'green' await nextTick() expect((vm.$el as HTMLElement).style.getPropertyValu...
fim
vuejs/vue
typescript
<|fim_suffix|>`) const attrEnd = source.indexOf(`">`) + 1 expect(generateCodeFrame(source, attrStart, attrEnd)).toBe( ` 1 | <div attr="some | ^^^^^^^^^^ 2 | multiline | ^^^^^^^^^^^ 3 | attr | ^^^^ 4 | "> | ^ `.trim() ) }) }) <|fim_prefix|>import { generateCodeFrame...
fim
vuejs/vue
typescript
<|fim_suffix|>tionName()">', `with(this){return _c('input',{on:{"input":function($event){return functionName()}}})}` ) }) it('generate events with multiple statements', () => { // normal function assertCodegen( '<input @input="onInput1();onInput2()">', `with(this){return _c('input',{o...
fim
vuejs/vue
typescript
<|fim_suffix|>tor.rule) this.result[validator.name] = ret }) }, methods: { // something validators logic required(val) { return val.length > 0 }, max(val, rule) { return !(parseInt(val, 10) > parseI...
fim
vuejs/vue
typescript
<|fim_suffix|>xpect(ast.children[0].static).toBe(true) }) it('style binding', () => { const ast = parse('<p :style="error">{{msg}}</p>', baseOptions) optimize(ast, baseOptions) expect(ast.static).toBe(false) expect(ast.children[0].static).toBe(false) }) it('key', () => { const ast = parse(...
fim
vuejs/vue
typescript
<|fim_suffix|> const options = extend({}, baseOptions) delete options.getTagNamespace const ast = parse('<svg><text>hello world</text></svg>', options) expect(ast.tag).toBe('svg') expect(ast.ns).toBeUndefined() }) it('not specified mustUseProp', () => { const options = extend({}, baseOptions) ...
fim
vuejs/vue
typescript
<|fim_suffix|> expect(dep.subs.length).toBe(1) expect(dep.subs[0]).toBe(null) }) }) describe('removeSub()', () => { it('should remove sub', () => { const sub = {} dep.subs.push(sub) dep.removeSub(sub) expect(dep.subs.includes(sub)).toBe(false) // nulled subs are cleared...
fim
vuejs/vue
typescript
<|fim_suffix|>should work on non-observed objects const obj2 = { a: 1 } delProp(obj2, 'a') expect(hasOwn(obj2, 'a')).toBe(false) // should work on Object.create(null) const obj3: any = Object.create(null) obj3.a = 1 const ob3 = observe(obj3) as any const dep3 = ob3.dep vi.spyOn(dep3,...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { MAX_UPDATE_COUNT, queueWatcher as _queueWatcher } from 'core/observer/scheduler' function queueWatcher(watcher) { watcher.vm = {} // mock vm _queueWatcher(watcher) } describe('Scheduler', () => { let spy beforeEach(() => { spy = vi.fn() }) it('queueWat...
fim
vuejs/vue
typescript
<|fim_suffix|>hen(done) }) it('warn not support path', () => { new Watcher(vm, 'd.e + c', spy) expect('Failed watching path:').toHaveBeenWarned() }) }) <|fim_prefix|>import Vue from 'vue' import Watcher from 'core/observer/watcher' describe('Watcher', () => { let vm, spy beforeEach(() => { vm = ...
fim
vuejs/vue
typescript
import { ssrCompile } from 'server/compiler' describe('ssrCompile options', () => { it('comments', () => { const compiled = ssrCompile( ` <div> <!-- test comments --> </div> `, { comments: true } ) expect(compiled.render).toContain('<!-- test comments -->') }) }) <|...
fim
vuejs/vue
typescript
<|fim_suffix|>() => { Vue.config.errorHandler = originalHandler expect(handler.mock.calls.length).toBe(1) expect(userCatch).toHaveBeenCalledWith(err) done() }) }) } }) <|fim_prefix|>import Vue from 'vue' import { invokeWithErrorHandling } from 'core/util/error' des...
fim
vuejs/vue
typescript
<|fim_suffix|> } }) <|fim_prefix|>import { nextTick } from 'core/util/next-tick' describe('nextTick', () => { it('accepts a callback', done => { nextTick(done) }) it('returns undefined when passed a callback', () => { expect(nextTick(<|fim_middle|>() => {})).toBeUndefined() }) if (typeof Promise !=...
fim
vuejs/vue
typescript
<|fim_prefix|>import { toString } from 'core/util/index' i<|fim_suffix|> b: { c: ref(1) } }) ).toBe(JSON.stringify({ a: 0, b: { c: 1 } }, null, 2)) }) <|fim_middle|>mport { ref } from 'v3' test('should unwrap refs', () => { expect( toString({ a: ref(0), <|endoftext|>
fim
vuejs/vue
typescript
<|fim_suffix|>c, data, vm, vm) setCurrentRenderingInstance(null) expect(vnode.isComment).toBe(true) // failed, still a comment node expect( `Failed to resolve async component: ${async}\nReason: ${reason}` ).toHaveBeenWarned() done() } go() }) it('not create a component...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { createEmptyVNode } from 'core/vdom/vnode' describe('create-element', () => { it('render vnode with basic reserved tag using createElement', () => { const vm = new Vue({ data: { msg: 'hello world' } }) const h = vm.$createElement const vnode = h('p', ...
fim
vuejs/vue
typescript
<|fim_suffix|>) it('should set the xlink value to attr', () => { const vnode = new VNode('a', { attrs: { 'xlink:href': '#id1' } }) const elm = patch(null, vnode) expect(elm.getAttributeNS(xlinkNS, 'href')).toBe('#id1') }) it('should set the xlink boolean string value to attr', () => { const vnod...
fim
vuejs/vue
typescript
<|fim_prefix|>import { patch } from 'web/runtime/patch' import VNode from 'core/vdom/vnode' describe('vdom class module', () => { it('should create an element with staticClass', () => { const vnode = new VNode('p', { staticClass: 'class1' }) const elm = patch(null, vnode) expect(elm).toHaveClass('class1'...
fim
vuejs/vue
typescript
<|fim_suffix|> modifiers: { modifier1: true } } ] }, undefined, 'hello world', undefined, vm ) ]) patch(vnode1, vnode2) expect(directive1.update).toHaveBeenCalled() // destroy const vnode3 = new VNode('div') patch(vnode2...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { patch } from 'web/runtime/patch' import VNode from 'core/vdom/vnode' describe('vdom domProps module', () => { it('should c<|fim_suffix|>ld initialize the elements value to zero', () => { const vnode = new VNode('input', { domProps: { value: 0 } }) const elm = patc...
fim
vuejs/vue
typescript
<|fim_prefix|>import { patch } from 'web/runtime/patch' import VNode from 'core/vdom/vnode' describe('vdom events module', () => { it('should attach event handler to element', () => { const click = vi.fn() const vnode = new VNode('a', { on: { click } }) const elm = patch(null, vnode) document.body.a...
fim
vuejs/vue
typescript
<|fim_prefix|>import { pa<|fim_suffix|>should create an element with style', () => { const vnode = new VNode('p', { style: { fontSize: '12px' } }) const elm = patch(null, vnode) expect(elm.style.fontSize).toBe('12px') }) it('should create an element with array style', () => { const vnode = new VNod...
fim
vuejs/vue
typescript
<|fim_prefix|>import { patch } from 'web/runtime/patch' import VNode, { createEmptyVNode } from 'core/vdom/vnode' function prop(name) { return obj => { return obj[name] } } function map(fn, list) { const ret: any[] = [] for (let i = 0; i < list.length; i++) { ret[i] = fn(list[i]) } return ret } f...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from 'vue' import { SSR_ATTR } from 'shared/constants' describe('vdom patch: edge cases', () => { // exposed by #3406 // When a static vnode is inside v-for, it's possible for the same vnode // to be used in multiple places, and its element will be replaced. This // causes patch errors...
fim
vuejs/vue
typescript
<|fim_suffix|> elm = patch(null, vnode) expect(elm.innerHTML).toBe('hello world') }) it('should create an elements which having span and text content', () => { const vnode = new VNode('div', {}, [ new VNode('span'), createTextVNode('hello world') ]) const elm = patch(null, vnode) ex...
fim
vuejs/vue
typescript
<|fim_suffix|>ild 2') ]), new VNode('span', {}, undefined, "can't touch me") ]) patch(vnode0, vnode1) expect(result.length).toBe(1) }) }) <|fim_prefix|>import { patch } from 'web/runtime/patch' import { createPatchFunction } from 'core/vdom/patch' import baseModules from 'core/vdom/modules/ind...
fim
vuejs/vue
typescript
<|fim_suffix|>n child component', () => { const dom = createMockSSRDOM('<div><span></span></div>') new Vue({ template: '<div><test></test></div>', components: { test: { template: '<div><a></a></div>' } } }).$mount(dom) expect('not matching server-rendered co...
fim
vuejs/vue
typescript
<|fim_prefix|>process.env.NEW_SLOT_SYNT<|fim_suffix|>-for-update' import { triggerEvent } from './helpers/trigger-event' import { createTextVNode } from './helpers/vdom' global.waitForUpdate = waitForUpdate global.triggerEvent = triggerEvent global.createTextVNode = createTextVNode <|fim_middle|>AX = 'true' import '....
fim
vuejs/vue
typescript
<|fim_prefix|>import { DefineComponent } from <|fim_suffix|>ement) => void> } export declare const Transition: DefineComponent<TransitionProps> export type TransitionGroupProps = Omit<TransitionProps, 'mode'> & { tag?: string moveClass?: string } export declare const TransitionGroup: DefineComponent<TransitionGr...
fim
vuejs/vue
typescript
<|fim_prefix|>export type Data = { [key: string]: unknown } export type UnionToIntersection<U> = ( U extends any ? (k: U) => void : never ) extends (k: infer I) => void ? I : never // Conditional returns can enforce identical types. // See here: https://github.com/Microsoft/TypeScript/issues/27024#issue<|fim_su...
fim
vuejs/vue
typescript
<|fim_suffix|>t { SetupFunction, // v2 already has option with same name and it's for a single computed ComputedOptions as ComponentComputedOptions, MethodOptions as ComponentMethodOptions, ComponentPropsOptions, ComponentCustomOptions, ComponentOptionsMixin, ComponentOptionsWithoutProps, ComponentOpt...
fim
vuejs/vue
typescript
<|fim_prefix|>// This code is based on react definition in DefinitelyTyped published under the MIT license. // Repository: https://github.com/DefinitelyTyped/DefinitelyTyped // Path in the repository: types/react/index.d.ts // // Copyrights of original definition are: // AssureSign <http://www.assuresign...
fim
vuejs/vue
typescript
<|fim_prefix|>import { Vue, CreateElement, CombinedVueInstance } from './vue' import { VNode, VNodeData, VNodeDirective, NormalizedScopedSlot } from './vnode' import { SetupContext } from './v3-setup-context' import { DebuggerEvent } from './v3-generated' import { DefineComponent } from './v3-define-component' import {...
fim
vuejs/vue
typescript
<|fim_suffix|>PluginFunction<T> [key: string]: any } <|fim_prefix|>im<|fim_middle|>port { Vue as _Vue } from './vue' export type PluginFunction<T> = (Vue: typeof _Vue, options?: T) => void export interface PluginObject<T> { install: <|endoftext|>
fim
vuejs/vue
typescript
<|fim_suffix|>=> { res({ default: { template: '' } }) }) }) // Test that Vue.component accepts any AsyncComponent Vue.component('async-component1', a) <|fim_prefix|>import Vue, { AsyncComponent, Component } from '../index' const a: AsyncComponent = () => ({ component: new Promise<Compo...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue, { defineComponent } from '../in<|fim_suffix|> this.$instanceMethod this.$instanceProperty } }) <|fim_middle|>dex' declare module '../vue' { // add instance property and method interface Vue { $instanceProperty: string $instanceMethod(): void } // add static property ...
fim
vuejs/vue
typescript
export default { data() { return {} } } <|endoftext|>
fim
vuejs/vue
typescript
<|fim_suffix|> 'foo' }, props: { myProp: 'bar' }, directives: [ { name: 'a', value: 'foo' } ], domProps: { innerHTML: 'baz' }, on: { click: new Function() }, nativeOn...
fim
vuejs/vue
typescript
<|fim_prefix|>import Vue from '../index' import { PluginFunction, PluginObject } from '../index<|fim_suffix|>Function<Option> = function (Vue, option) {} Vue.use(plugin, new Option()) Vue.use(installer, new Option()) Vue.use(installer, new Option(), new Option(), new Option()) <|fim_middle|>' class Option { prefix:...
fim
vuejs/vue
typescript
<|fim_suffix|>expect-error emit2('baz') }) describe('useAttrs', () => { const attrs = useAttrs() expectType<Record<string, unknown>>(attrs) }) describe('useSlots', () => { const slots = useSlots() expectType<SetupContext['slots']>(slots) }) <|fim_prefix|>import { useAttrs, useSlots, SetupContext } from '../...
fim
vuejs/vue
typescript
<|fim_prefix|>const vm = new Vue({ template: '<div>hi</div>' }) const options: Vue.ComponentOptions<Vue> = { template: '<d<|fim_suffix|> } <|fim_middle|>iv>test</div>'<|endoftext|>
fim
vuejs/vue
typescript
<|fim_prefix|>export declare function describe(_name: string, _fn: () => void): void export declare function test(_name: st<|fim_suffix|>2 extends T = T>(value: T2): void export type IsUnion<T, U extends T = T> = ( T extends any ? (U extends T ? false : true) : never ) extends false ? false : true export type I...
fim
vuejs/vue
typescript
<|fim_suffix|> defineAsyncComponent(() => Promise.resolve({})) // @ts-expect-error defineAsyncComponent({}) defineAsyncComponent({ loader: () => Promise.resolve({}), loadingComponent: defineComponent({}), errorComponent: defineComponent({}), delay: 123, timeout: 3000, onError(err, retry, fail, attempts) ...
fim
vuejs/vue
typescript
<|fim_suffix|>neComponent({ props: { baseA: { type: Number, default: 1 } } }) const MixinA = defineComponent({ props: { mA: { type: String, default: '' } } }) const CompA = defineComponent({ extends: Base, mixins: [MixinA], prop...
fim
vuejs/vue
typescript
<|fim_prefix|>import { InjectionKey, provide, inject } from '../../index' import { expectType } from '../utils' const key: InjectionKey<number> = Symbol() provide(key, 1) // @ts-expect-error provide(key, 'foo') expectType<number | undefined>(inject(key)) expectType<number>(inject(key, 1)) expectType<number>(inject(k...
fim
vuejs/vue
typescript
<|fim_prefix|>import { Ref, ref, shallowRef, isRef, unref, reactive, toRef, toRefs, ToRefs, shallowReactive, readonly, markRaw, shallowReadonly, set, del } from '../../index' import { IsUnion, describe, expectType } from '../utils' function plainType(arg: number | Ref<number>) { // ref ...
fim
vuejs/vue
typescript
<|fim_suffix|>expect-error this.$emit('bar') } } }) defineComponent({ props: { foo: null as any as PropType<{ a: number }> }, data() { this.foo?.a }, setup(props) { const res = props.foo?.a.toFixed(2) // @ts-expect-error res.charAt(1) res?.charAt(1) } }) // #12568 const...
fim
vuejs/vue
typescript
<|fim_suffix|>r ;<Foo bar="1" /> // @ts-expect-error ;<Foo bar={1} foo={2} /> // working ;<Foo bar={1} /> ;<Foo bar={1} foo="baz" /> ;<div slot="x" /> export default ({ data }: RenderContext) => { return <button {...data} /> } <|fim_prefix|>import { VNode, defineComponent, ref, RenderContext } from '../../index' im...
fim
vuejs/vue
typescript
<|fim_prefix|>import { ref, computed, watch, shallowRef } from '../../index' import {<|fim_suffix|>alues, oldValues) => { expectType<Readonly<[string, string, number]>>(values) expectType<Readonly<[string, string, number]>>(oldValues) }) // immediate watcher's oldValue will be undefined on first run. watch( sour...
fim
vuejs/vue
typescript
<|fim_suffix|>a]) } }) declare function decorate<VC extends typeof Vue>(v: VC): VC @decorate class Decorated extends Vue { a = 123 } const obj = Vue.observable({ a: 1 }) obj.a++ // VNodeData style tests. const ComponentWithStyleInVNodeData = Vue.extend({ render(h) { const elementWithStyleAsString = h('div...
fim
vuejs/vue
typescript
<|fim_suffix|>pace Vue <|fim_prefix|>import * as V from './index' import { DefaultData, DefaultProps, DefaultMethods, DefaultComputed, PropsDefinition } from './options' // Expose some types for backward compatibility... declare namespace Vue { // vue.d.ts export type CreateElement = V.CreateElement ex...
fim
vuejs/vue
typescript
<|fim_suffix|> M, Mixin, Extends, Emits > > export type ComponentOptionsWithArrayProps< PropNames extends string = string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Ex...
fim
vuejs/vue
typescript
<|fim_suffix|> } ? K : never }[keyof T] type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>> type ExtractFunctionPropType< T extends Function, TArgs extends Array<any> = any[], TResult = any > = T extends (...args: TArgs) => TResult ? T : never type ExtractCorrectPropType<T> = T extends Function ...
fim
vuejs/vue
typescript
<|fim_prefix|>import { DebuggerEvent, ShallowUnwrapRef, UnwrapNestedRefs } from './v3-generated' import { UnionToIntersection } from './common' import { Vue, VueConstructor } from './vue' import { ComputedOptions, MethodOptions, ExtractComputedReturns, ComponentOptionsMixin, ComponentOptionsBase } from...
fim
vuejs/vue
typescript
<|fim_suffix|>s ): AsyncComponent <|fim_prefix|>import { AsyncComponent, Component } from './options' export type AsyncComponentResolveResult<T = Component> = T | { default: T } // es modules export type AsyncComponentLoader<T = any> = () => Promise< AsyncComponentResolveResult<T> > export interface AsyncComponent...
fim
vuejs/vue
typescript
<|fim_suffix|>aration * * see `ExtractPropTypes` in './componentProps.ts' */ export function defineComponent< Props, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin...
fim
vuejs/vue
typescript
<|fim_suffix|>tionDirective<T, V> <|fim_prefix|>import type { VNodeDirective, VNode } from './vnode' export type DirectiveModifiers = Record<string, boolean> export interface DirectiveBinding<V> extends Readonly<VNodeDirective> { readonly modifiers: DirectiveModifiers readonly value: V readonly oldValue: V | nu...
fim
vuejs/vue
typescript
<|fim_suffix|> const h: CreateElement export function useSlots(): SetupContext['slots'] export function useAttrs(): SetupContext['attrs'] export function useListeners(): SetupContext['listeners'] <|fim_prefix|>import { SetupContext } from './v3-setup-context'<|fim_middle|> import { CreateElement, Vue } from './vue' e...
fim
vuejs/vue
typescript
<|fim_prefix|>import { VNode } from './vnode' import { Data, UnionToIntersection } from './common' import { Vue } from './vue' export type Slot = (...args: any[]) => VNode[] export type Slots = Record<string, Slot | undefined> export type ObjectEmitsOptions = Record< string, ((...args: any[]) => any) | null > e...
fim
vuejs/vue
typescript
<|fim_prefix|>import { EmitFn, EmitsOptions } from './v3-setup-context' import { ComponentObjectPropsOptions, ExtractPropTypes } from './v3-component-props' /** * Vue `<script setup>` compiler macro for declaring component props. The * expected argument is the same as the component `props` option. * * Example ...
fim
vuejs/vue
typescript
<|fim_prefix|>import { StyleValue } from './jsx' import { Vue } from './vue' import { DirectiveFunction, DirectiveOptions } from './options' import { Ref } from './v3-generated' import { ComponentPublicInstance } from './v3-component-public-instance' /** * For extending allowed non-declared props on components in TSX...
fim
vuejs/vue
typescript
<|fim_prefix|>import { Component, AsyncComponent, ComponentOptions, FunctionalComponentOptions, DirectiveOptions, DirectiveFunction, RecordPropsDefinition, ThisTypedComponentOptionsWithArrayProps, ThisTypedComponentOptionsWithRecordProps, WatchOptions } from './options' import { VNode, VNodeData, VN...
fim
vuejs/vue
typescript
import { resolve as _resolve } from 'path' import { defineConfig } from 'vitest/config' const resolve = (p: string) => _resolve(__dirname, p) export default defineConfig({ resolve: { alias: { compiler: resolve('src/compiler'), core: resolve('src/core'), server: resolve('packages/server-rendere...
fim
vuejs/vue
typescript
<|fim_suffix|>tions' }, { text: 'Actions', link: '/guide/actions' }, { text: 'Modules', link: '/guide/modules' } ] }, { text: 'Advanced', children: [ { text: 'Application Structure', link: '/guide/structure' }, ...
fim
vuejs/vuex
javascript
<|fim_prefix|>import '../styles/styles.css' import DefaultTheme from 'vit<|fim_suffix|>/dist/client/theme-default' export default { ...DefaultTheme } <|fim_middle|>epress<|endoftext|>
fim
vuejs/vuex
javascript
<|fim_prefix|>const data = require('./mock-data') const LATENCY = 16 export function getAllMessages (cb) { setTimeout(() => { cb(data) }, LATENCY) } export function createMessage ({ text, thread }, cb) { const timestamp = Date.now() const id = 'm_' + timest<|fim_suffix|>ID: thread.id, threadName: thre...
fim
vuejs/vuex
javascript
module.exports = [ { id: 'm_1', threadID: 't_1', threadName: 'Jing and Bill', authorName: 'Bill', text: 'Hey Jing, want to give a Flux talk at ForwardJS?', timestamp: Date.now() - 99999 }, { id: 'm_2', threadID: 't_1', threadName: 'Jing and Bill', authorName: 'Bill', te...
fim
vuejs/vuex
javascript
<|fim_suffix|>essages } from './store/actions' const app = createApp(App) app.use(store) app.mount('#app') getAllMessages(store) <|fim_prefix|>import { createApp } from 'vue' import App from './components/App.vue' import store from './st<|fim_middle|>ore' import { getAllM<|endoftext|>
fim
vuejs/vuex
javascript
<|fim_suffix|>rt const sendMessage = ({ commit }, payload) => { api.createMessage(payload, message => { commit('receiveMessage', message) }) } export const switchThread = ({ commit }, payload) => { commit('switchThread', payload) } <|fim_prefix|>import * as api from '../api' export <|fim_middle|>const getAl...
fim
vuejs/vuex
javascript
<|fim_suffix|>tThreadID] : {} } export const currentMessages = state => { const thread = currentThread(state) return thread.messages ? thread.messages.map(id => state.messages[id]) : [] } export const unreadCount = ({ threads }) => { return Object.keys(threads).reduce((count, id) => { return thr...
fim
vuejs/vuex
javascript