0.1.1 • Published 2 years ago

@withtypes/fs-extra v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@withtypes/fs-extra

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).

# Just install this package
npm i @withtypes/fs-extra

This replaces the original problem of needing to install twice:

# No need to install this now
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)
// 0.1.0

Documentation

See: Documentation of FS-Extra

License

MIT License © 2022 chengpeiquan