Category | Utilities |
---|---|
Export Size | 86 B |
Last Changed | 2 weeks ago |
Non-nullish checking type guard for Ref.
import { isDefined } from '@vueuse/core' const example = ref(Math.random() ? 'example' : undefined) // Ref<string | undefined> if (isDefined(example)) example // Ref<string>
export declare function isDefined<T>( v: Ref<T> ): v is Ref<Exclude<T, null | undefined>> export declare function isDefined<T>( v: ComputedRef<T> ): v is ComputedRef<Exclude<T, null | undefined>> export declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/shared/isDefined/