Closed
Description
- Version:
14.17.0
&16.4.0
- Platform:
local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101 arm64
- Subsystem: FS / Docs
What steps will reproduce the bug?
import { writeFileSync } from 'fs';
writeFileSync('test.log', { foo: 'bar' });
How often does it reproduce? Is there a required condition?
100% (no special conditions)
What is the expected behavior?
The type(s) for data
listed in the docs to work.
What do you see instead?
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an
instance of Buffer, TypedArray, or DataView. Received an instance of Object
at writeFileSync (node:fs:2136:5)
Additional information
fs docs for 14.x and 16.x both include <Object>
as a type for writeFileSync's data
argument:
data
<string>
|<Buffer>
|<TypedArray>
|<DataView>
|<Object>