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

Mismatch Between ProgressChanged Type Definition and Runtime Structure #7

Open
OlufNielsen opened this issue Jan 3, 2025 · 1 comment

Comments

@OlufNielsen
Copy link

Description

I have identified a mismatch between the ProgressChanged type definition provided in the library and the actual structure observed at runtime. Specifically, the NewProgress and OldProgress objects do not match the documented type definition and instead contain an additional nested structure.

Expected Behavior

The type definition in index.d.ts (lines 4147-4172) indicates the following structure for ProgressChanged:

class ProgressChanged extends ITHit.WebDAV.Client.Upload.Events.BaseEvent { 
    OldProgress: ITHit.WebDAV.Client.Upload.Progress 
    NewProgress: ITHit.WebDAV.Client.Upload.Progress 
    Name: string 
    Sender: Object 
 }

At runtime, I expect NewProgress and OldProgress to directly contain properties like UploadedBytes, TotalBytes, etc.


Observed Behavior

At runtime, the NewProgress and OldProgress object contains an additional nested ProgressChanged object, as shown in the console logs:

{
    "Name": "OnProgressChanged",
    "NewProgress": {
        "Name": "OnProgressChanged",
        "NewProgress": {},
        "OldProgress": {},
        "Sender": {}
    },
    "OldProgress": {
        "Name": "OnProgressChanged",
        "NewProgress": {},
        "OldProgress": {},
        "Sender": {}
    },
    "Sender": {}
}

Environment

  • Library Version: 5.21.6001
  • Environment: Browser
  • TypeScript Version: 5.5.4

Additional Context

This mismatch can lead to runtime errors or confusion when working with the library in TypeScript, as the actual structure does not align with the documented types. For example, the following code fails unless adjusted for the nesting:

console.log(event.NewProgress?.UploadedBytes); // Undefined
console.log(event.NewProgress?.NewProgress?.UploadedBytes); // 10030
@ITHitBuild
Copy link
Contributor

As far as I see this is an issue with class reference documentation. We are working to resolve it in the next update.

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