mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #30610 from Toilal/mem-fs
[mem-fs] Fix return type of methods and arguments of create method
This commit is contained in:
6
types/mem-fs/index.d.ts
vendored
6
types/mem-fs/index.d.ts
vendored
@@ -10,13 +10,13 @@ import { Transform } from 'stream';
|
||||
import * as File from 'vinyl';
|
||||
|
||||
export interface Store extends EventEmitter {
|
||||
add: (file: File, content: string) => void;
|
||||
each: (callback: (file: File, index: number) => void) => void;
|
||||
get: (filepath: string) => File;
|
||||
add: (file: File) => this;
|
||||
each: (callback: (file: File, index: number) => void) => this;
|
||||
stream: () => Transform;
|
||||
}
|
||||
|
||||
export function create(...args: any[]): Store;
|
||||
export function create(): Store;
|
||||
|
||||
export namespace memFs {
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ import * as fs from 'mem-fs';
|
||||
const store: fs.Store = fs.create();
|
||||
const file = store.get('hello');
|
||||
|
||||
store.add(file, 'hahahahah');
|
||||
|
||||
store.each(file => console.dir(store.get(file.path)));
|
||||
const file2 = store.add(file)
|
||||
.each(file => console.dir(store.get(file.path)))
|
||||
.get('test');
|
||||
|
||||
Reference in New Issue
Block a user