Skip to content

No inlay hints for property declaration types inferred from constructor #57445

@bgenia

Description

@bgenia

🔎 Search Terms

"inlay hints", "inlayHints.propertyDeclarationTypes"

🕗 Version & Regression Information

TS: 5.3.3
VSC: 1.87.0-insider
OS: Windows_NT x64 10.0.22631

Settings:

{
  "javascript.inlayHints.enumMemberValues.enabled": true,
  "javascript.inlayHints.functionLikeReturnTypes.enabled": true,
  "javascript.inlayHints.parameterNames.enabled": "all",
  "javascript.inlayHints.parameterTypes.enabled": true,
  "javascript.inlayHints.propertyDeclarationTypes.enabled": true,
  "javascript.inlayHints.variableTypes.enabled": true,
  "typescript.inlayHints.enumMemberValues.enabled": true,
  "typescript.inlayHints.functionLikeReturnTypes.enabled": true,
  "typescript.inlayHints.parameterNames.enabled": "all",
  "typescript.inlayHints.parameterTypes.enabled": true,
  "typescript.inlayHints.propertyDeclarationTypes.enabled": true,
  "typescript.inlayHints.variableTypes.enabled": true,
}

⏯ Playground Link

No response

💻 Code

class Foo {
	bar

	constructor(value: number) {
		this.bar = value

		if (value <= 0) {
			this.bar = null
		}
	}
}

🙁 Actual behavior

Property bar is correctly inferred as number | null, but an inlay hint is not displayed.
image

🙂 Expected behavior

I expect an inlay hint.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions