Skip to content

Commit

Permalink
@uppy/core: fix some type errors (#5015)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Mar 22, 2024
1 parent 9692f25 commit 68af8a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions packages/@uppy/core/src/BasePlugin.ts
Expand Up @@ -49,17 +49,17 @@ export default class BasePlugin<

opts: Opts

id: string
id!: string

defaultLocale: OptionalPluralizeLocale

i18n: I18n
i18n!: I18n

i18nArray: Translator['translateArray']
i18nArray!: Translator['translateArray']

type: string
type!: string

VERSION: string
VERSION!: string

constructor(uppy: Uppy<M, B>, opts?: Opts) {
this.uppy = uppy
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/core/src/Restricter.ts
Expand Up @@ -41,7 +41,7 @@ const defaultOptions = {
class RestrictionError<M extends Meta, B extends Body> extends Error {
isUserFacing: boolean

file: UppyFile<M, B>
file!: UppyFile<M, B>

constructor(
message: string,
Expand Down
14 changes: 7 additions & 7 deletions packages/@uppy/core/src/Uppy.ts
Expand Up @@ -379,17 +379,17 @@ export class Uppy<M extends Meta, B extends Body> {

defaultLocale: Locale

locale: Locale
locale!: Locale

// The user optionally passes in options, but we set defaults for missing options.
// We consider all options present after the contructor has run.
opts: NonNullableUppyOptions<M, B>

store: NonNullableUppyOptions<M, B>['store']

i18n: I18n
i18n!: I18n

i18nArray: Translator['translateArray']
i18nArray!: Translator['translateArray']

scheduledAutoProceed: ReturnType<typeof setTimeout> | null = null

Expand Down Expand Up @@ -839,7 +839,7 @@ export class Uppy<M extends Meta, B extends Body> {
try {
this.#restricter.validate(files, [file])
} catch (err) {
return err
return err as any
}
return null
}
Expand Down Expand Up @@ -1030,7 +1030,7 @@ export class Uppy<M extends Meta, B extends Body> {
nextFilesState[newFile.id] = newFile
validFilesToAdd.push(newFile)
} catch (err) {
errors.push(err)
errors.push(err as any)
}
}

Expand All @@ -1042,7 +1042,7 @@ export class Uppy<M extends Meta, B extends Body> {
validFilesToAdd,
)
} catch (err) {
errors.push(err)
errors.push(err as any)

// If we have any aggregate error, don't allow adding this batch
return {
Expand Down Expand Up @@ -2146,7 +2146,7 @@ export class Uppy<M extends Meta, B extends Body> {
* Start an upload for all the files that are not currently being uploaded.
*/
upload(): Promise<NonNullable<UploadResult<M, B>> | undefined> {
if (!this.#plugins.uploader?.length) {
if (!this.#plugins['uploader']?.length) {
this.log('No uploader type plugins are used', 'warning')
}

Expand Down

0 comments on commit 68af8a3

Please sign in to comment.