How to use the @tsed/core.isClass function in @tsed/core

To help you get started, we’ve selected a few @tsed/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / test / units / core / utils / ObjectUtils.spec.ts View on Github external
it("should return false (obj)", () => {
      expect(isClass(Object)).to.eq(false);
    });
github TypedProject / ts-express-decorators / test / units / core / utils / ObjectUtils.spec.ts View on Github external
it("should return false (arrow function)", () => {
      expect(isClass(() => {})).to.eq(false);
    });
github TypedProject / ts-express-decorators / test / units / core / utils / ObjectUtils.spec.ts View on Github external
it("should return false (date)", () => {
      expect(isClass(new Date())).to.eq(false);
    });
github TypedProject / ts-express-decorators / packages / common / src / jsonschema / registries / JsonSchemesRegistry.ts View on Github external
private static createJsonSchema(schema: JsonSchema = new JsonSchema(), type: any, collectionType?: any): JsonSchema {
    if (isClass(type)) {
      schema = Object.keys(schema.toObject()).reduce((newSchema: any, key: string) => {
        if (!(key === "type" || key === "items" || key === "additionalProperties")) {
          newSchema[key] = schema[key];
        }

        return newSchema;
      }, JsonSchema.ref(type));
    } else {
      schema.type = type;
    }

    if (collectionType) {
      schema.toCollection(collectionType);
    }

    return schema!;
github TypedProject / ts-express-decorators / packages / di / src / class / Provider.ts View on Github external
set useClass(value: Type) {
    if (isClass(value)) {
      this._useClass = getClass(value);
      this._store = Store.from(value);
    }
  }
github TypedProject / ts-express-decorators / packages / common / src / server / utils / importComponents.ts View on Github external
async function resolveSymbols(item: any, excludes: string[]) {
  if (isClass(item)) {
    return await [item];
  }

  return importFiles(item, excludes);
}
github TypedProject / ts-express-decorators / packages / di / src / errors / InjectionError.ts View on Github external
static throwInjectorError(token: any, currentDependency: any, error: any) {
    if (currentDependency && isClass(token)) {
      error.message = printDependencyInjectionError(token, {...currentDependency, message: error.message});
    }

    throw new InjectionError(token, error);
  }
}
github TypedProject / ts-express-decorators / packages / common / src / di / class / Bootstrap.ts View on Github external
        .filter(token => isClass(token) && GlobalProviders.has(token))!;
    } catch (er) {