From 7598f8034db33b24d96eb1e55e1700c913aca0ab Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Fri, 10 Nov 2023 16:55:16 -0300 Subject: [PATCH] Test that we can import the Types namespace --- test/package/browser/template/src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/package/browser/template/src/index.ts b/test/package/browser/template/src/index.ts index e360efcc34..865bc21e60 100644 --- a/test/package/browser/template/src/index.ts +++ b/test/package/browser/template/src/index.ts @@ -1,13 +1,18 @@ -import { Realtime } from 'ably'; +import { Realtime, Types } from 'ably'; import { createSandboxAblyAPIKey } from './sandbox'; +// This function exists to check that we can import the Types namespace and refer to its types. +async function attachChannel(channel: Types.RealtimeChannel) { + await channel.attach(); +} + globalThis.testAblyPackage = async function () { const key = await createSandboxAblyAPIKey(); const realtime = new Realtime({ key, environment: 'sandbox' }); const channel = realtime.channels.get('channel'); - await channel.attach(); + await attachChannel(channel); const receivedMessagePromise = new Promise((resolve) => { channel.subscribe(() => {