value to check
Rest
...requiredProperties: (keyof T)[]expected properties to exist
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;
};
Type Guard checking for properties to exist. Workaround for
microsoft/TypeScript#21732
to help to implement type guards checking subsequent property value types.