Skip to content
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

Using client.smartCollectionSync defaults to wrong type declaration for detailedResult (always Falsy) vs using smartCollectionSync independently #201

Closed
garshythoel opened this issue Jul 26, 2024 · 2 comments

Comments

@garshythoel
Copy link

garshythoel commented Jul 26, 2024

For my code here:

const {
          created: createdObjects,
          updated: updatedObjects,
          deleted: deletedObjects
        } = (
          await client.smartCollectionSync({
            collection: {
              url: calendar.url,
              ctag: calendar.ctag,
              syncToken: calendar.syncToken,
              objects: localObjects.map(dbEventToDAVObject),
              objectMultiGet: client.calendarMultiGet
            },
            method: 'webdav',
            detailedResult: true
          })
        ).objects;

The TS typechecker throws error since it expects detailedResult to always be false (image below)
CleanShot 2024-07-26 at 10 19 33@2x

This also leads to the typechecker picking up the wrong overload for the function returns type and consequently errors on accessing created, updated and deleted

When i use smartCollectionSync directly (not from the clientMethod) - the overload for detailedResult: true is successfully picked up and no error

CleanShot 2024-07-26 at 10 21 29@2x

I also get the same issues using syncCalendars independently vs from the DAVClient method.

I can use the methods directly but since the examples in the documentation are all DAVClient based probably a good idea to fix the overloads

@natelindev
Copy link
Owner

will take a look this week.

@natelindev
Copy link
Owner

fixed in v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants