2018-12-06 18:07:31 +00:00
|
|
|
import emptyDir = require('empty-dir');
|
|
|
|
|
|
|
|
|
|
emptyDir('./', (err, isEmpty) => {
|
|
|
|
|
// $ExpectType ErrnoException
|
|
|
|
|
err;
|
|
|
|
|
// $ExpectType boolean
|
|
|
|
|
isEmpty;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// $ExpectType boolean
|
|
|
|
|
emptyDir.sync('./test/empty');
|
|
|
|
|
|
|
|
|
|
function filter(filepath: string) {
|
|
|
|
|
return !/(Thumbs\.db|\.DS_Store)$/i.test(filepath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emptyDir('./', filter, (err, isEmpty) => {
|
|
|
|
|
// $ExpectType ErrnoException
|
|
|
|
|
err;
|
|
|
|
|
// $ExpectType boolean
|
|
|
|
|
isEmpty;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// $ExpectType boolean
|
|
|
|
|
emptyDir.sync('./test/empty', filter);
|
2019-06-04 23:48:36 +00:00
|
|
|
|
|
|
|
|
// $ExpectType Promise<boolean>
|
|
|
|
|
emptyDir('./');
|
|
|
|
|
|
|
|
|
|
// $ExpectType Promise<boolean>
|
|
|
|
|
emptyDir('./', filter);
|