Skip to content

[5.3] Type error in typescript.d.ts with exactOptionalPropertyTypes = trueΒ #56478

Closed
@uid11

Description

@uid11

πŸ”Ž Search Terms

"exactOptionalPropertyTypes", "JsDocParsingMode".

πŸ•— Version & Regression Information

⏯ Playground Link

No response

πŸ’» Code

// "exactOptionalPropertyTypes": true,

import type { CompilerOptions } from "typescript";

export type { CompilerOptions };

πŸ™ Actual behavior

Error:

node_modules/typescript/lib/typescript.d.ts:3287:24 - error TS2420: Class 'Project' incorrectly implements interface 'LanguageServiceHost'.
  Types of property 'jsDocParsingMode' are incompatible.
    Type 'JSDocParsingMode | undefined' is not assignable to type 'JSDocParsingMode'.
      Type 'undefined' is not assignable to type 'JSDocParsingMode'.

3287         abstract class Project implements LanguageServiceHost, ModuleResolutionHost {
                            ~~~~~~~


Found 1 error in node_modules/typescript/lib/typescript.d.ts:3287

πŸ™‚ Expected behavior

No error.

Additional information about the issue

Minimal repository with bug reproduction: https://github.com/uid11/jsDocParsingMode-error-example.

As far as I can see, to fix this error, it is enough to replace the line

jsDocParsingMode?: JSDocParsingMode;

with

    jsDocParsingMode?: JSDocParsingMode | undefined;

Although, perhaps, such errors with exactOptionalPropertyTypes are corrected differently.

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions