Files
DefinitelyTyped/types/graceful-fs/graceful-fs-tests.ts
Dimitri Benin 32f2b57713 [graceful-fs] upgrade to 4.1, improve typings, enable strict null checks and linting (#19257)
* [graceful-fs] upgrade to 4.1, improve typings, enable strict null checks and linting

* [graceful-fs] correctly re-export interfaces & types from fs, add docs
2017-08-23 13:18:50 -07:00

30 lines
1.0 KiB
TypeScript

import gfs = require('graceful-fs');
import * as gfs2 from 'graceful-fs';
import * as fs from 'fs';
import * as fse from 'fs-extra';
import { promisify } from 'util';
const str = '';
const buf = new Buffer('');
// verify that interfaces & types are correctly re-exported
const watcher: gfs.FSWatcher | null = null;
gfs.renameSync(str, str);
gfs2.chmodSync(buf, 1);
const gracefulified = gfs.gracefulify(fs);
gracefulified; // $ExpectType typeof "fs" & Lutimes
gracefulified.lutimes; // $ExpectType typeof lutimes
promisify(gracefulified.lutimes); // $ExpectType (path: PathLike, atime: string | number | Date, mtime: string | number | Date) => Promise<void>
const fseGrace = gfs.gracefulify(fse);
fseGrace.lutimes; // $ExpectType typeof lutimes
fs.lutimes(buf, str, str);
fs.lutimes(buf, str, str, err => {
err; // $ExpectType ErrnoException | null
});
fs.lutimesSync(buf, str, str);
promisify(fs.lutimes); // $ExpectType (path: PathLike, atime: string | number | Date, mtime: string | number | Date) => Promise<void>