diff --git a/package.json b/package.json index 9e718c7..be957c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@altiore/twa", - "version": "1.2.4", + "version": "1.2.5", "description": "React components for Telegram WebApp", "source": "./src/index.ts", "type": "module", diff --git a/src/useInitData.ts b/src/useInitData.ts index 04e6ab2..3afd151 100644 --- a/src/useInitData.ts +++ b/src/useInitData.ts @@ -56,10 +56,10 @@ export type InitDataUnsafe = { * ``` * @group Hooks */ -const useInitData = (): { initUnsafe: InitDataUnsafe; init: InitData } => { +const useInitData = (): { initUnsafe?: InitDataUnsafe; init?: InitData } => { const WebApp = useWebApp(); - return { initUnsafe: WebApp!.initDataUnsafe, init: WebApp!.initData }; + return { initUnsafe: WebApp?.initDataUnsafe, init: WebApp?.initData }; }; export default useInitData;