0

宣言ファイル 'dropzone.d.ts'から 'Dropzone'型が見つかりません。ここで 宣言ファイルから型が見つかりませんTypescript

は宣言ファイルです:

// Type definitions for Dropzone 4.3.0 
 
// Project: http://www.dropzonejs.com/ 
 
// Definitions by: Natan Vivo <https://github.com/nvivo>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Vasya Aksyonov <https://github.com/outring>, Simon Huber <https://github.com/renuo> 
 
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 
 

 
/// <reference path="../../typings/jquery.d.ts"/> 
 

 
interface DropzoneResizeInfo { 
 
\t srcX?:number; 
 
\t srcY?:number; 
 
\t trgX?:number; 
 
\t trgY?:number; 
 
\t srcWidth?:number; 
 
\t srcHeight?:number; 
 
\t trgWidth?:number; 
 
\t trgHeight?:number; 
 
\t optWidth?:number; 
 
\t optHeight?:number; 
 
} 
 

 
interface DropzoneFile extends File { 
 
\t previewElement: HTMLElement; 
 
\t previewTemplate: HTMLElement; 
 
\t previewsContainer: HTMLElement; 
 
\t status: string; 
 
\t accepted: boolean; 
 
} 
 

 
interface DropzoneOptions { 
 
\t url?: string; 
 
\t method?: string; 
 
\t withCredentials?: boolean; 
 
\t parallelUploads?: number; 
 
\t uploadMultiple?: boolean; 
 
\t maxFilesize?: number; 
 
\t paramName?: string; 
 
\t createImageThumbnails?: boolean; 
 
\t maxThumbnailFilesize?: number; 
 
\t thumbnailWidth?: number; 
 
\t thumbnailHeight?: number; 
 
\t filesizeBase?: number; 
 
\t maxFiles?: number; 
 
\t params?: {}; 
 
\t headers?: {}; 
 
\t clickable?: boolean|string|HTMLElement|(string|HTMLElement)[]; 
 
\t ignoreHiddenFiles?: boolean; 
 
\t acceptedFiles?: string; 
 
\t renameFilename?(name:string): string; 
 
\t autoProcessQueue?: boolean; 
 
\t autoQueue?: boolean; 
 
\t addRemoveLinks?: boolean; 
 
\t previewsContainer?: boolean|string|HTMLElement; 
 
\t hiddenInputContainer?: HTMLElement; 
 
\t capture?: string; 
 

 
\t dictDefaultMessage?: string; 
 
\t dictFallbackMessage?: string; 
 
\t dictFallbackText?: string; 
 
\t dictFileTooBig?: string; 
 
\t dictInvalidFileType?: string; 
 
\t dictResponseError?: string; 
 
\t dictCancelUpload?: string; 
 
\t dictCancelUploadConfirmation?: string; 
 
\t dictRemoveFile?: string; 
 
\t dictRemoveFileConfirmation?: string; 
 
\t dictMaxFilesExceeded?: string; 
 

 
\t accept?(file:DropzoneFile, done:(error?:string|Error) => void):void; 
 
\t init?():void; 
 
\t forceFallback?: boolean; 
 
\t fallback?():void; 
 
\t resize?(file:DropzoneFile):DropzoneResizeInfo; 
 

 
\t drop?(e:DragEvent):void; 
 
\t dragstart?(e:DragEvent):void; 
 
\t dragend?(e:DragEvent):void; 
 
\t dragenter?(e:DragEvent):void; 
 
\t dragover?(e:DragEvent):void; 
 
\t dragleave?(e:DragEvent):void; 
 
\t paste?(e:DragEvent):void; 
 

 
\t reset?():void; 
 

 
\t addedfile?(file:DropzoneFile):void; 
 
\t addedfiles?(files:DropzoneFile[]):void; 
 
\t removedfile?(file:DropzoneFile):void; 
 
\t thumbnail?(file:DropzoneFile, dataUrl:string):void; 
 

 
\t error?(file:DropzoneFile, message:string|Error, xhr:XMLHttpRequest):void; 
 
\t errormultiple?(files:DropzoneFile[], message:string|Error, xhr:XMLHttpRequest):void; 
 

 
\t processing?(file:DropzoneFile):void; 
 
\t processingmultiple?(files:DropzoneFile[]):void; 
 

 
\t uploadprogress?(file:DropzoneFile, progress:number, bytesSent:number):void; 
 
\t totaluploadprogress?(totalProgress:number, totalBytes:number, totalBytesSent:number):void; 
 

 
\t sending?(file:DropzoneFile, xhr:XMLHttpRequest, formData:FormData):void; 
 
\t sendingmultiple?(files:DropzoneFile[], xhr:XMLHttpRequest, formData:FormData):void; 
 

 
\t success?(file: DropzoneFile, response: Object|string): void; 
 
\t successmultiple?(files:DropzoneFile[], responseText:string):void; 
 

 
\t canceled?(file:DropzoneFile):void; 
 
\t canceledmultiple?(file:DropzoneFile[]):void; 
 

 
\t complete?(file:DropzoneFile):void; 
 
\t completemultiple?(file:DropzoneFile[]):void; 
 

 
\t maxfilesexceeded?(file:DropzoneFile):void; 
 
\t maxfilesreached?(files:DropzoneFile[]):void; 
 
\t queuecomplete?():void; 
 

 
\t previewTemplate?: string; 
 
} 
 

 
declare class Dropzone { 
 
\t constructor(container:string|HTMLElement, options?:DropzoneOptions); 
 

 
\t static autoDiscover:boolean; 
 
\t static options:any; 
 
\t static confirm:(question:string, accepted:() => void, rejected?:() => void) => void; 
 

 
\t static ADDED:string; 
 
\t static QUEUED:string; 
 
\t static ACCEPTED:string; 
 
\t static UPLOADING:string; 
 
\t static PROCESSING:string; 
 
\t static CANCELED:string; 
 
\t static ERROR:string; 
 
\t static SUCCESS:string; 
 

 
\t files:DropzoneFile[]; 
 

 
\t enable():void; 
 

 
\t disable():void; 
 

 
\t destroy():Dropzone; 
 

 
\t addFile(file:DropzoneFile):void; 
 

 
\t removeFile(file:DropzoneFile):void; 
 

 
\t removeAllFiles(cancelIfNecessary?:boolean):void; 
 

 
\t processQueue():void; 
 

 
\t cancelUpload(file:DropzoneFile):void; 
 

 
\t processFiles(files:DropzoneFile[]):void; 
 

 
\t processFile(file:DropzoneFile):void; 
 

 
\t uploadFile(file:DropzoneFile):void; 
 

 
\t getAcceptedFiles():DropzoneFile[]; 
 

 
\t getRejectedFiles():DropzoneFile[]; 
 

 
\t getQueuedFiles():DropzoneFile[]; 
 

 
\t getUploadingFiles():DropzoneFile[]; 
 

 
\t accept(file:DropzoneFile, done:(error?:string|Error) => void):void; 
 

 
\t getActiveFiles():DropzoneFile[]; 
 

 
\t getFilesWithStatus(status:string):DropzoneFile[]; 
 

 
\t enqueueFile(file:DropzoneFile):void; 
 

 
\t enqueueFiles(file:DropzoneFile[]):void; 
 

 
\t createThumbnail(file:DropzoneFile, callback?:(...args:any[]) => void):any; 
 

 
\t createThumbnailFromUrl(file:DropzoneFile, url:string, callback?:(...args:any[]) => void):any; 
 

 
\t on(eventName:string, callback:(...args:any[]) => void):Dropzone; 
 

 
\t off(eventName:string):Dropzone; 
 

 
\t emit(eventName:string, ...args:any[]):Dropzone; 
 

 
\t on(eventName:"drop", callback:(e:DragEvent) => any):Dropzone; 
 
\t on(eventName:"dragstart", callback:(e:DragEvent) => any):Dropzone; 
 
\t on(eventName:"dragend", callback:(e:DragEvent) => any):Dropzone; 
 
\t on(eventName:"dragenter", callback:(e:DragEvent) => any):Dropzone; 
 
\t on(eventName:"dragover", callback:(e:DragEvent) => any):Dropzone; 
 
\t on(eventName:"dragleave", callback:(e:DragEvent) => any):Dropzone; 
 
\t on(eventName:"paste", callback:(e:DragEvent) => any):Dropzone; 
 

 
\t on(eventName:"reset"):Dropzone; 
 

 
\t on(eventName:"addedfile", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"addedfiles", callback:(files:DropzoneFile[]) => any):Dropzone; 
 
\t on(eventName:"removedfile", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"thumbnail", callback:(file:DropzoneFile, dataUrl:string) => any):Dropzone; 
 

 
\t on(eventName:"error", callback:(file:DropzoneFile, message:string|Error) => any):Dropzone; 
 
\t on(eventName:"errormultiple", callback:(files:DropzoneFile[], message:string|Error) => any):Dropzone; 
 

 
\t on(eventName:"processing", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"processingmultiple", callback:(files:DropzoneFile[]) => any):Dropzone; 
 

 
\t on(eventName:"uploadprogress", callback:(file:DropzoneFile, progress:number, bytesSent:number) => any):Dropzone; 
 
\t on(eventName:"totaluploadprogress", callback:(totalProgress:number, totalBytes:number, totalBytesSent:number) => any):Dropzone; 
 

 
\t on(eventName:"sending", callback:(file:DropzoneFile, xhr:XMLHttpRequest, formData:FormData) => any):Dropzone; 
 
\t on(eventName:"sendingmultiple", callback:(files:DropzoneFile[], xhr:XMLHttpRequest, formData:FormData) => any):Dropzone; 
 

 
\t on(eventName:"success", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"successmultiple", callback:(files:DropzoneFile[]) => any):Dropzone; 
 

 
\t on(eventName:"canceled", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"canceledmultiple", callback:(file:DropzoneFile[]) => any):Dropzone; 
 

 
\t on(eventName:"complete", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"completemultiple", callback:(file:DropzoneFile[]) => any):Dropzone; 
 

 
\t on(eventName:"maxfilesexceeded", callback:(file:DropzoneFile) => any):Dropzone; 
 
\t on(eventName:"maxfilesreached", callback:(files:DropzoneFile[]) => any):Dropzone; 
 
\t on(eventName:"queuecomplete"):Dropzone; 
 

 
\t emit(eventName:"drop", e:DragEvent):Dropzone; 
 
\t emit(eventName:"dragstart", e:DragEvent):Dropzone; 
 
\t emit(eventName:"dragend", e:DragEvent):Dropzone; 
 
\t emit(eventName:"dragenter", e:DragEvent):Dropzone; 
 
\t emit(eventName:"dragover", e:DragEvent):Dropzone; 
 
\t emit(eventName:"dragleave", e:DragEvent):Dropzone; 
 
\t emit(eventName:"paste", e:DragEvent):Dropzone; 
 

 
\t emit(eventName:"reset"):Dropzone; 
 

 
\t emit(eventName:"addedfile", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"addedfiles", files:DropzoneFile[]):Dropzone; 
 
\t emit(eventName:"removedfile", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"thumbnail", file:DropzoneFile, dataUrl:string):Dropzone; 
 

 
\t emit(eventName:"error", file:DropzoneFile, message:string|Error):Dropzone; 
 
\t emit(eventName:"errormultiple", files:DropzoneFile[], message:string|Error):Dropzone; 
 

 
\t emit(eventName:"processing", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"processingmultiple", files:DropzoneFile[]):Dropzone; 
 

 
\t emit(eventName:"uploadprogress", file:DropzoneFile, progress:number, bytesSent:number):Dropzone; 
 
\t emit(eventName:"totaluploadprogress", totalProgress:number, totalBytes:number, totalBytesSent:number):Dropzone; 
 

 
\t emit(eventName:"sending", file:DropzoneFile, xhr:XMLHttpRequest, formData:FormData):Dropzone; 
 
\t emit(eventName:"sendingmultiple", files:DropzoneFile[], xhr:XMLHttpRequest, formData:FormData):Dropzone; 
 

 
\t emit(eventName:"success", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"successmultiple", files:DropzoneFile[]):Dropzone; 
 

 
\t emit(eventName:"canceled", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"canceledmultiple", file:DropzoneFile[]):Dropzone; 
 

 
\t emit(eventName:"complete", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"completemultiple", file:DropzoneFile[]):Dropzone; 
 

 
\t emit(eventName:"maxfilesexceeded", file:DropzoneFile):Dropzone; 
 
\t emit(eventName:"maxfilesreached", files:DropzoneFile[]):Dropzone; 
 
\t emit(eventName:"queuecomplete"):Dropzone; 
 

 
} 
 

 
interface JQuery { 
 
\t dropzone(options:DropzoneOptions): Dropzone; 
 
} 
 

 
declare module "dropzone" { 
 
\t export = Dropzone; 
 
}

私は、「名前空間のドロップゾーンを{}」を追加する必要があることを具体的に宣言ファイルに問題があるかもしれないことをここにオンラインhttps://github.com/Microsoft/TypeScript/issues/5073を見てきました私が試してみました。ここで

は私app.tsです:

///<reference path="../../typings/angular.d.ts" /> 
 
///<reference path="../../node_modules/underscore/underscore.d.ts" /> 
 
///<reference path="../../node_modules/dropzone/dropzone.d.ts" /> 
 

 
var underscore = angular.module('underscore', []); 
 

 
import * as Dropzone from "dropzone"; 
 
var app = angular.module('App', [ 
 
    'ui.router', 
 
    'App.common', 
 
    'App.home', 
 
    'angularSpinners', 
 
    'underscore', 
 
    'ui.bootstrap' 
 
]); 
 

 
app.directive("dropzone", function(){ 
 
    return function (scope, element, attrs) { 
 
     var config, dropzone; 
 
     config = scope["vm"]["$scope"]["dropzoneConfig"]; 
 
     // create a Dropzone for the element with the given options 
 
     window.onload = function() { 
 
     // access Dropzone here 
 
     dropzone = new Dropzone(element[0], config.options); 
 
     // bind the given event handlers 
 
     angular.forEach(config.eventHandlers, function (handler, event) { 
 
      dropzone.on(event, handler); 
 
     }); 
 
     }; 
 
    }; 
 
});

現在の誤差がある:「エラーTS2497:モジュール 『『ドロップゾーンは、』』非モジュールエンティティに解決してインポートすることはできませんこの構造体を使用しています。 "だから、私は名前空間(namespace dropzone {})を宣言ファイルに追加しようとしましたが、エラーは同じです。追加時に(名前空間Dropzone {})コンパイル時にエラーはありませんが、実行時に "Uncaught ReferenceError:Dropzone is not defined"というエラーが発生します。

本当にありがとうございます。

おかげ

答えて

0

デフォルトは、デフォルトとしてエクスポートする場合は、以下の

declare module "modulename" { 

    interface A { 
     ...somproperties 
    } 
    class someClass extends someSuperClass{ 

    } 

} 

ような何かをしようとエクスポートされていない場合は、

declare module "modulename" { 

    interface A { 
     ...somproperties 
    } 
export default class someClass extends someSuperClass{ 

    } 

} 
+0

だから、私はモジュール宣言内のクラス宣言を移動しなければならないと言っています? – SwimmingG

+0

はい、それはあなたを助けることができます – abhirathore2006

関連する問題