Closed P00HB33R closed 1 month ago
Summary
Getting the error "Property 'HSStaticMethods' does not exist on type 'Window & typeof globalThis'" when adding the afterNavigate function as per documentation for sveltekit
Steps to Reproduce
- Create new sveltekit project as per docs.
- Add afterNavigate function HSStatic
Demo Link
Expected Behavior
There should be no error
Actual Behavior
Property 'HSStaticMethods' does not exist on type 'Window & typeof globalThis'
Screenshots
No response
Hi, For now you can declare static methods in a file. We'll add it globally in future versions.
import { IStaticMethods } from 'preline/src/static/interfaces';
declare global {
interface Window {
HSStaticMethods: IStaticMethods;
}
}
Summary
Getting the error "Property 'HSStaticMethods' does not exist on type 'Window & typeof globalThis'" when adding the afterNavigate function as per documentation for sveltekit
Steps to Reproduce
- Create new sveltekit project as per docs.
- Add afterNavigate function HSStatic
Demo Link
Expected Behavior
There should be no error
Actual Behavior
Property 'HSStaticMethods' does not exist on type 'Window & typeof globalThis'
Screenshots
No response
Hi, For now you can declare static methods in a file. We'll add it globally in future versions.
import { IStaticMethods } from 'preline/src/static/interfaces'; declare global { interface Window { HSStaticMethods: IStaticMethods; } }
You comment is timely as I also had a similar issue. Thank you.
However, on implemantation, I did not know where to declare it (just getting started with Sveltekit). So, I gathered that this should be done in a global.d.ts or index.d.ts file (I prefered setting it up within the src folder). I found further reading on it here, check it out in case you need more infor on it:
https://robkendal.co.uk/blog/how-to-fix-property-does-not-exist-on-window-type-in-typescript/.
Hey @P00HB33R - please check out the latest version, the issue has been fixed. Thanks!
Thank you. Barry Sande.
On Tue, Sep 24, 2024, 00:21 Jaha Ganiev @.***> wrote:
Hey @P00HB33R https://github.com/P00HB33R - please check out the latest version, the issue has been fixed. Thanks!
— Reply to this email directly, view it on GitHub https://github.com/htmlstreamofficial/preline/issues/401#issuecomment-2369415667, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDC7UR6ND57NWIWHOX6SPG3ZYCA5DAVCNFSM6AAAAABKE6V6ZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZGQYTKNRWG4 . You are receiving this because you commented.Message ID: @.***>
Summary
Getting the error "Property 'HSStaticMethods' does not exist on type 'Window & typeof globalThis'" when adding the afterNavigate function as per documentation for sveltekit
Steps to Reproduce
Demo Link
#
Expected Behavior
There should be no error
Actual Behavior
Property 'HSStaticMethods' does not exist on type 'Window & typeof globalThis'
Screenshots
No response