0
私はmocha仕様を取得して、フロータイプで実施するようにFile
を作成しようとしています。フロータイプと互換性のあるdomクラスを模擬する方法File
以下は、^^^^^^ object literal. This type is incompatible with File
である。
これを行う適切な方法は何ですか?
/**
*
* declare class Blob {
* constructor(blobParts?: Array<any>, options?: {
* type?: string;
* endings?: string;
* }): void;
* isClosed: bool;
* size: number;
* type: string;
* close(): void;
* slice(start?: number, end?: number, contentType?: string): Blob;
* }
*
* declare class File extends Blob {
* constructor(
* fileBits: $ReadOnlyArray<string | BufferDataSource | Blob>,
* filename: string,
* options?: FilePropertyBag,
* ): void;
* lastModifiedDate: any;
* name: string;
* }
*
* @param name
* @param type
* @returns {*}
*/
function newFile (name: string, type?: string): File {
const result = { name, type }
return (result: File)
}
[フローでの強制キャスティング](https://stackoverflow.com/questions/41328728/force-casting-in-flow)の可能な複製 – loganfsmyth