mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-07 22:38:13 +08:00
resolve: fix type of readFileSync (#22571)
This commit is contained in:
committed by
Mohamed Hegazy
parent
46afc73cfb
commit
ff8a4cfaa2
3
types/resolve/index.d.ts
vendored
3
types/resolve/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for resolve
|
||||
// Project: https://github.com/substack/node-resolve
|
||||
// Definitions by: Mario Nebl <https://github.com/marionebl>
|
||||
// Klaus Meinhardt <https://github.com/ajafff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -88,7 +89,7 @@ declare namespace resolve {
|
||||
|
||||
export interface SyncOpts extends Opts {
|
||||
// how to read files synchronously (defaults to fs.readFileSync)
|
||||
readFileSync?: (file: string) => Buffer;
|
||||
readFileSync?: (file: string, charset: string) => string | Buffer;
|
||||
// function to synchronously test whether a file exists
|
||||
isFile?: (file: string) => boolean;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ function test_options_sync() {
|
||||
}
|
||||
});
|
||||
console.log(resolved);
|
||||
resolved = resolve.sync('typescript', {
|
||||
readFileSync(file, charset) {
|
||||
return fs.readFileSync(file, charset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_is_core() {
|
||||
|
||||
Reference in New Issue
Block a user