0
の両方をエクスポートだから私は、モジュールのための私自身のタイプのDEFを作っ:活字体はクラスとタイプ
declare module 'fs-tree-diff' {
interface FSEntry {
relativePath: string;
mode: number;
size: number;
mtime: number;
isDirectory:() => boolean;
}
type Operation = 'unlink' | 'create' | 'mkdir' | 'change' | 'rmdir';
type PatchEntry = [Operation, string, FSEntry];
type Patch = PatchEntry[];
type FSEntries = FSEntry[];
class FSTree {
constructor (options: {entries: FSEntries, sortAndExpand?: boolean});
static fromEntries (entries: FSEntries): FSTree;
static fromPaths (paths: string[]): FSTree;
addEntries (entries: FSEntries, options: {sortAndExpand: boolean}): void;
addPath (paths: string[], options: {sortAndExpand: boolean}): void;
forEach (fn: any, context: any): void;
calculatePatch (other: FSTree, isEqual?: (a: FSEntry, b: FSEntry) => boolean): Patch;
}
export = FSTree;
}
だから今、私はどこでも行うことができます。
import FSTree = require('fs-tree-diff');
const tree = new FSTree({entries: []});
、それが作品を!私は私のモジュール宣言、それが他の輸出にエクスポートすることはできませんexport = ...
の端部に言うには、すべてのtype
前export
を追加しようとした場合しかし、私は
import FSTree = require('fs-tree-diff');
const tree = new FSTree({entries: []});
let entry: FSTree.FSEntry;
...
を行うことができるようになりましたたいと思います。他のファイルから私のdefにアクセスするにはどうすればいいですか?私はその見つかっよく見る、と@types/bluebird
をチェックした後
探していたものでした。多くのDT入力はこの形式に変更する必要があります。 :) – unional
btw、彼らはなぜmodue部分を宣言しないのですか? – Vinz243
https://github.com/types/*は 'npm install @ types/*'ではありません。 'npm install @ types/*'はhttps://github.com/definitelytyped/definitelytyped – unional