Files
directus/packages/utils/shared/is-vue-component.ts
Pascal Jufer b3cf23acff Show options for list & map interfaces again (#18603)
* 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>
2023-05-16 12:19:04 +02:00

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';
}