Skip to content

Commit 624b8a2

Browse files
authored
Fix topic types (#4678)
1 parent 5be104a commit 624b8a2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/@types/topic.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
17-
import { EitherAnd } from "matrix-events-sdk";
18-
1916
import { UnstableValue } from "../NamespacedValue.ts";
2017
import { IMessageRendering } from "./extensible_events.ts";
2118

@@ -52,12 +49,17 @@ export const M_TOPIC = new UnstableValue("m.topic", "org.matrix.msc3765.topic");
5249
*/
5350
export type MTopicContent = IMessageRendering[];
5451

52+
type MTopicStable = { [M_TOPIC.altName]: MTopicContent };
53+
type MTopicUnstable = { [M_TOPIC.name]: MTopicContent };
54+
5555
/**
5656
* The event definition for an m.topic event (in content)
5757
*/
58-
export type MTopicEvent = EitherAnd<{ [M_TOPIC.name]: MTopicContent }, { [M_TOPIC.altName]: MTopicContent }>;
58+
export type MTopicEvent = (MTopicStable & MTopicUnstable) | MTopicStable | MTopicUnstable;
5959

6060
/**
6161
* The event content for an m.room.topic event
6262
*/
63-
export type MRoomTopicEventContent = { topic: string | null | undefined } & (MTopicEvent | {});
63+
export type MRoomTopicEventContent = {
64+
topic: string | null | undefined;
65+
} & Partial<MTopicEvent>;

0 commit comments

Comments
 (0)