@vue/composition-api
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -0,1 +1,23 @@ | ||
# 0.2.1 | ||
* Declare your expected prop types directly in TypeScript: | ||
```js | ||
import { createComponent, createElement as h } from '@vue/composition-api' | ||
interface Props { | ||
msg: string | ||
} | ||
const MyComponent = createComponent<Props>({ | ||
setup(props) { | ||
return () => h('div', props.msg) | ||
} | ||
}) | ||
``` | ||
* Declare ref type in TypeScript: | ||
```js | ||
const dateRef = ref<Date>(new Date); | ||
``` | ||
* Fix `createComponent` not working with `import()` [#81](https://github.com/vuejs/composition-api/issues/81). | ||
* Fix `inject` type declaration [#83](https://github.com/vuejs/composition-api/issues/83). | ||
# 0.2.0 | ||
@@ -2,0 +24,0 @@ ## Fixed |
export interface InjectionKey<T> extends Symbol { | ||
} | ||
export declare function provide<T>(key: InjectionKey<T> | string, value: T): void; | ||
export declare function inject<T>(key: InjectionKey<T> | string): T | void; | ||
export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T): T; |
import Vue, { VueConstructor, VNode, ComponentOptions as Vue2ComponentOptions } from 'vue'; | ||
import { ComponentPropsOptions, ExtractPropTypes } from './componentProps'; | ||
import { UnwrapRef } from '../reactivity'; | ||
import { HasDefined } from '../types/basic'; | ||
export declare type Data = { | ||
@@ -20,3 +21,3 @@ [key: string]: unknown; | ||
new (): ComponentRenderProxy<ExtractPropTypes<PropsOptions>, UnwrapRef<RawBindings>, ExtractPropTypes<PropsOptions, false>>; | ||
}; | ||
} & VueConstructor<never>; | ||
declare type VueProxy<PropsOptions, RawBindings> = Vue2ComponentOptions<never, UnwrapRef<RawBindings>, never, never, PropsOptions, ExtractPropTypes<PropsOptions, false>> & VueConstructorProxy<PropsOptions, RawBindings>; | ||
@@ -34,7 +35,7 @@ export interface SetupContext { | ||
export declare type SetupFunction<Props, RawBindings> = (this: void, props: Props, ctx: SetupContext) => RawBindings | RenderFunction<Props>; | ||
export interface ComponentOptions<PropsOptions = ComponentPropsOptions, RawBindings = Data, Props = ExtractPropTypes<PropsOptions>> { | ||
interface ComponentOptions<PropsOptions = ComponentPropsOptions, RawBindings = Data, Props = ExtractPropTypes<PropsOptions>> { | ||
props?: PropsOptions; | ||
setup?: SetupFunction<Props, RawBindings>; | ||
} | ||
export declare function createComponent<PropsOptions, RawBindings>(options: ComponentOptions<PropsOptions, RawBindings> & Omit<Vue2ComponentOptions<Vue>, keyof ComponentOptions<never, never>>): VueProxy<PropsOptions, RawBindings>; | ||
export declare function createComponent<Props, RawBindings = Data, PropsOptions = ComponentPropsOptions>(options: (HasDefined<Props> extends true ? ComponentOptions<PropsOptions, RawBindings, Props> : ComponentOptions<PropsOptions, RawBindings>) & Omit<Vue2ComponentOptions<Vue>, keyof ComponentOptions<never, never>>): VueProxy<PropsOptions, RawBindings>; | ||
export {}; |
import { Data } from '../component'; | ||
import { HasDefined } from '../types/basic'; | ||
declare type BailTypes = Function | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any>; | ||
@@ -45,4 +46,4 @@ export interface Ref<T> { | ||
export declare function ref<T = undefined>(): Ref<T | undefined>; | ||
export declare function ref<T, R = RefValue<T>>(raw: T): Ref<R>; | ||
export declare function ref<T, R = RefValue<T>>(raw: T | null): Ref<R | null>; | ||
export declare function ref<T = null>(raw: null): Ref<T | null>; | ||
export declare function ref<S, T = unknown, R = HasDefined<S> extends true ? S : RefValue<T>>(raw: T): Ref<R>; | ||
export declare function isRef<T>(value: any): value is Ref<T>; | ||
@@ -49,0 +50,0 @@ declare type Refs<Data> = { |
export declare type AnyObject = Record<string | number | symbol, any>; | ||
declare type Equal<Left, Right> = (<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false; | ||
export declare type HasDefined<T> = Equal<T, unknown> extends true ? false : true; | ||
export {}; |
{ | ||
"name": "@vue/composition-api", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Provide logic composition capabilities for Vue.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270844
6334