Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Created June 22, 2022 11:59
Show Gist options
  • Save rummelonp/4bc8f5e055dbf1a9f4e1cdb00d84554d to your computer and use it in GitHub Desktop.
Save rummelonp/4bc8f5e055dbf1a9f4e1cdb00d84554d to your computer and use it in GitHub Desktop.
@types/activestorage が最新に追従出来てないので雑対応
declare module '@rails/activestorage' {
export function start(): void
export class DirectUpload {
id: number
file: File
url: string
constructor(file: File, url: string, serviceName: string, attachmentName: string, delegate?: DirectUploadDelegate)
create(callback: (error: Error | null, blob: Blob | null) => void): void
}
export interface DirectUploadDelegate {
directUploadWillCreateBlobWithXHR?: ((xhr: XMLHttpRequest) => void) | undefined
directUploadWillStoreFileWithXHR?: ((xhr: XMLHttpRequest) => void) | undefined
}
export interface Blob {
filename: string
content_type: string
byte_size: number
checksum: string
id: number
signed_id: string
key: string
service_name: string
created_at: string
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment