mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
- v2 for backward compatibility - migrate return type from `null` to `undefined` https://github.com/avajs/find-cache-dir#readme Thanks!
20 lines
892 B
TypeScript
20 lines
892 B
TypeScript
import findCacheDir = require('find-cache-dir');
|
|
|
|
findCacheDir({ name: 'unicorns' }); // $ExpectType string | undefined
|
|
findCacheDir({ name: 'unicorns', files: 'foo' }); // $ExpectType string | undefined
|
|
findCacheDir({ name: 'unicorns', files: ['foo', 'bar'] }); // $ExpectType string | undefined
|
|
findCacheDir({ name: 'unicorns', cwd: 'foo' }); // $ExpectType string | undefined
|
|
findCacheDir({ name: 'unicorns', create: true }); // $ExpectType string | undefined
|
|
findCacheDir({ name: 'unicorns', thunk: false }); // $ExpectType string | undefined
|
|
findCacheDir({}); // $ExpectError
|
|
findCacheDir(); // $ExpectError
|
|
|
|
const thunk = findCacheDir({ name: 'unicorns', thunk: true });
|
|
thunk; // $ExpectType ((...pathParts: string[]) => string) | undefined
|
|
|
|
if (thunk) {
|
|
thunk(); // $ExpectType string
|
|
thunk('bar.js'); // $ExpectType string
|
|
thunk('baz', 'quz.js'); // $ExpectType string
|
|
}
|