correct check for class constructor

This commit is contained in:
Niels Lyngsø
2023-11-14 14:47:33 +01:00
parent 47a241ab56
commit 918d6b32ca
2 changed files with 2 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import type { ApiLoaderExports, ApiLoaderProperty, ClassConstructor, ElementAndA
export async function loadManifestApi<ApiType extends UmbApi>(property: ApiLoaderProperty<ApiType> | ElementAndApiLoaderProperty<any, ApiType>): Promise<ClassConstructor<ApiType> | undefined> {
const propType = typeof property
if(propType === 'function') {
if(typeof property.constructor === 'function') {
if((property as ClassConstructor).prototype) {
// Class Constructor
return property as ClassConstructor<ApiType>;
} else {

View File

@@ -4,7 +4,7 @@ import type { ApiLoaderExports, ClassConstructor, ElementAndApiLoaderProperty, E
export async function loadManifestElement<ElementType extends HTMLElement>(property: ElementLoaderProperty<ElementType> | ElementAndApiLoaderProperty<ElementType>): Promise<ClassConstructor<ElementType> | undefined> {
const propType = typeof property
if(propType === 'function') {
if(typeof property.constructor === 'function') {
if((property as ClassConstructor).prototype) {
// Class Constructor
return property as ClassConstructor<ElementType>;
} else {