diff --git a/src/models/PolicyList.ts b/src/models/PolicyList.ts index 54e6bb9..26c74a4 100644 --- a/src/models/PolicyList.ts +++ b/src/models/PolicyList.ts @@ -162,7 +162,7 @@ class PolicyList extends EventEmitter { }; // Guard room type in case someone overwrites it when declaring custom creation_content in future code. const roomType = finalRoomCreateOptions.creation_content?.type; - if (typeof roomType === 'string' && !PolicyList.ROOM_TYPE_VARIANTS.includes(roomType)) { + if (typeof roomType !== 'string' || !PolicyList.ROOM_TYPE_VARIANTS.includes(roomType)) { throw new TypeError(`Creating a policy room with a type other than the policy room type is not supported, you probably don't want to do this.`); } const listRoomId = await client.createRoom(finalRoomCreateOptions);