CoreMedia CKEditor 5 Plugins
    Preparing search index...

    Function isRaw

    • Type Guard checking for properties to exist. Workaround for microsoft/TypeScript#21732 to help to implement type guards checking subsequent property value types.

      Type Parameters

      • T

        target guarded type

      Parameters

      • value: unknown

        value to check

      • ...requiredProperties: (keyof T)[]

        expected properties to exist

      Returns value is Raw<T>

      const isEditorWithUI = <T extends Editor>(value: T): value is T & EditorWithUI => {
      // first see, if required keys are available
      if (isRaw<EditorWithUI>(value, "ui")) {
      // then check these keys if they pass the type-guard
      return typeof value.ui === "object";
      }
      return false;
      };