Skip to content

Interface 'ErrnoException' incorrectly extends interface 'Error' with exactOptionalPropertyTypes enabled #54725

@techmunk

Description

@techmunk

Discussed in #54673

Originally posted by techmunk July 22, 2021
Ts 4.4@next, building with exactOptionalPropertyTypes causes this error:

node_modules/@types/node/globals.d.ts:172:15 - error TS2430: Interface 'ErrnoException' incorrectly extends interface 'Error'.
  Types of property 'stack' are incompatible.
    Type 'string | undefined' is not assignable to type 'string'.
      Type 'undefined' is not assignable to type 'string'.

172     interface ErrnoException extends Error {
                  ~~~~~~~~~~~~~~


Found 1 error.

Changing stack property to match declaration in typescripts lib.es5.d.ts resolves this issue.

I believe this was added in #54342 in preparation for the next typescript release.

This is the only issue I've noticed building with exactOptionalPropertyTypes enabled so far. Though my current test case is very limited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions