mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* Fix options for list & map interfaces * Create short-boxes-rescue.md * Outsource Vue component check to utils * No need for explicit comparation * Depend on `typeof` instead of `instanceof` to check Vue comp Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> * make linter happy --------- Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> Co-authored-by: Brainslug <tim@brainslug.nl>
11 lines
454 B
TypeScript
11 lines
454 B
TypeScript
import type { Component } from 'vue';
|
|
import { isObject } from './is-object.js';
|
|
|
|
export function isVueComponent(input: unknown): input is Component {
|
|
if (!isObject(input)) return false;
|
|
|
|
// A Vue component usually provides a 'setup' and/or 'render' function
|
|
// (unfortunately there is no more accurate way to find out, but this should be enough for most cases)
|
|
return typeof input['setup'] === 'function' || typeof input['render'] === 'function';
|
|
}
|