Skip to content

fs.openSync flags parameter should be optional #7174

@pfusik

Description

@pfusik

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 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions