denoland / denoland/std

`fs.openSync` `flags` parameter should be optional

Open
#7,174 1 comment 0 reactions 0 assignees View on GitHub
bug needs triage
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

**Steps to Reproduce**

```
C:\0\src>cat openSync.ts
import fs from "node:fs";
fs.openSync("foo");

C:\0\src>deno --check openSync.ts
```

**Expected behavior**

No TS error. `flags` is [documented optional](https://nodejs.org/api/fs.html#fsopensyncpath-flags-mode) and seems to work without `--check`.

**Actual behavior**

```
Check openSync.ts
TS2554 [ERROR]: Expected 2-3 arguments, but got 1.
fs.openSync("foo");
~~~~~~~~
at file:///C:/0/src/openSync.ts:2:4

An argument for 'flags' was not provided.
export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
~~~~~~~~~~~~~~~
at asset:///node/fs.d.cts:2296:46

error: Type checking failed.

info: The program failed type-checking, but it still might work correctly.
hint: Re-run with --no-check to skip type-checking.
```

**Environment**

- OS: Windows 11
- deno version: deno 2.8.2 (stable, release, x86_64-pc-windows-msvc)
- std version:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.