FS-Extra with types.
Merged fs-extra and @types/fs-extra , install this package to get both, no other features.
Why?
I got tired of having to install an additional @types/**
package every time in my TypeScript project to support type inference for these utilities.
So I merged them, but in fact, after installing this package, the original package will still be installed implicitly, and all functions are provided by the original package.
Installation
Install the package from npm (or yarn, or pnpm).
npm i @withtypes/fs-extra
This replaces the original problem of needing to install twice:
npm i fs-extra
npm i -D @types/fs-extra
Usage
This package does not have its own function implementation, Just replace the package name in the import
statement.
-import fs from 'fs-extra'
+import fs from '@withtypes/fs-extra'
This package also supports named imports:
-import { readFileSync } from 'fs-extra'
+import { readFileSync } from '@withtypes/fs-extra'
So it is exactly the same APIs as the original package in use.
import { resolve } from 'path'
import { readJSONSync } from '@withtypes/fs-extra'
const pkg = resolve('./package.json')
const { version } = readJSONSync(pkg, 'utf-8')
console.log(version)
Documentation
See: Documentation of FS-Extra
License
MIT License © 2022 chengpeiquan