tus-js-client icon indicating copy to clipboard operation
tus-js-client copied to clipboard

typescript: Replace file types with interfaces

Open Acconut opened this issue 2 years ago • 4 comments

Currently, the definitions reference browser-specific types, which do not exist in other environments, e.g. in Node.js: https://github.com/tus/tus-js-client/blob/239343a75da5aaedeefbc3bf2438062554b5db8d/lib/index.d.ts#L8

It would be better to replace them with interfaces, so we are independent of the environment (pseudo-code):

interface IBlob {
  slice(start, end): IBlob;
}

interface IReader {
  read(): Promise<IBlob>;
}

This could prevent issues like https://github.com/tus/tus-js-client/issues/252

Acconut avatar Oct 18 '21 12:10 Acconut