Skip to content

Type CommentJSONValue object properties #42

@felixhaeberle

Description

@felixhaeberle

Tell us about your environment

I'm running this inside a vscode extension to parse the extensions.json

  • Node Version: 18.16.1
  • comment-json Version 4.2.3

Please show your use case / code slices / code link that could reproduce the issue

I want to have the returned value of parse correctly typed. It should return an json with recommendations as string[], but I can't get it to work.

let extensions: CommentJSONValue<{ recommendations: string[] }> |  undefined // doesn't work
extensions = parse(fs.readFileSync(extensionsJsonPath, "utf8"))
extensions?.recommendations?.includes("example.extension") || false // doesn't work

What did you expect to happen?

I want to have the recommendations typed correctly.
Thank you for your help!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions