You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type '{ endpoint: string; token: string; expiresAt: Date | undefined; }' does not satisfy the expected type'PowerSyncCredentials'.
Types of property 'expiresAt' are incompatible.
Type 'Date | undefined' is not assignable to type'Date'.
Type 'undefined' is not assignable to type'Date'.ts(1360)
In all your tsconfig files, start using exactOptionalPropertyTypes for safer code.
The text was updated successfully, but these errors were encountered:
guillempuche
changed the title
[Improvement/Web] Define undefined in PowerSyncCredentials type
[Improvement/Web] Define undefined in PowerSyncCredentialsSep 30, 2024
Proposition
Modify
expiresAt
type inPowerSyncCredentials
https://github.com/powersync-ja/powersync-js/blob/66412323c27a54d8623bba17c5e54832f5b60063/packages/common/src/client/connection/PowerSyncCredentials.ts#L1-L6 toProblem
In
fetchCredentials
ofPowerSyncBackendConnector
like herepowersync-js/demos/react-supabase-todolist/src/library/powersync/SupabaseConnector.ts
Lines 99 to 103 in 6641232
I'm using a restrictive Tsconfig,
exactOptionalPropertyTypes
. And I'm also usingsatisfies
to be safer:I get this compile error.
Provisional Solution
Suggestion
In all your tsconfig files, start using
exactOptionalPropertyTypes
for safer code.The text was updated successfully, but these errors were encountered: