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

Typescript cannot detect UppyFile error property #4962

Closed
2 tasks done
KingMatrix1989 opened this issue Feb 25, 2024 · 1 comment
Closed
2 tasks done

Typescript cannot detect UppyFile error property #4962

KingMatrix1989 opened this issue Feb 25, 2024 · 1 comment
Labels

Comments

@KingMatrix1989
Copy link

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

Suppose we have a variable with type UppyFile

const file: UppyFile<any,any>;

According to UppyFile definition, it should have the error property too, but it doesn't show.

interface UploadedUppyFile<
  TMeta extends IndexedObject<any>,
  TBody extends IndexedObject<any>,
> extends UppyFile<TMeta, TBody> {
  uploadURL: string
}

interface FailedUppyFile<
  TMeta extends IndexedObject<any>,
  TBody extends IndexedObject<any>,
> extends UppyFile<TMeta, TBody> {
  error: string
}


interface State<
  TMeta extends IndexedObject<any> = Record<string, unknown>,
  TBody extends IndexedObject<any> = Record<string, unknown>,
> extends IndexedObject<any> {
  // .... 
  files: {
    [key: string]: UploadedUppyFile<TMeta, TBody> | FailedUppyFile<TMeta, TBody>
  }
  // ...
}

image

Expected behavior

file.error should have the correct type.

Actual behavior

image

@Murderlon
Copy link
Member

Hi, the source is moving to TS we but haven't published the types yet. It still uses the old manual types in types/. Otherwise we would constantly push breaking type changes. Instead we migrate everything and flip the switch at once, minimising the pain for users.

This should resolve itself. In the meantime you have to use subpar types.

@Murderlon Murderlon closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants