-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing false to serialize gives typescript error #465
Comments
Hi, thanks for the report. I guess I messed something up in the apollo-cache-persist/src/types/index.ts Lines 21 to 23 in eded0ff
Maybe providing a declare type StorageType<
T,
TSerialize extends boolean
> = TSerialize extends true
? PersistentStorage<string>
: TSerialize extends false
? PersistentStorage<T>
: PersistentStorage<string>; I'll look into this, but not sooner than by the end of the week. @MasterOdin if you by any chance try working on #464, could you check whether the change above fixes the issue? Thanks! |
I tried, and it did not resolve the problem. I think the problem lies with: apollo-cache-persist/src/types/index.ts Line 27 in eded0ff
where TS is not smart enough to see that I'm passing it |
👋 I made a PR over in #471 to address this, TS does need to have the explicit link downward through generics typically, otherwise it'll use the default parameter (it's like calling a function with optional params, if you don't pass in a generic, you'll always get the default). |
Looking at the Additional Options doc, it gives:
but on trying to pass
false
, I get the tsc error:To get by this, I'm ignoring the error via a tsc annotation, but that definitely feels hacky and there didn't seem an obvious way to let tsc accept
false
.The text was updated successfully, but these errors were encountered: