Skip to content

scripts prop on generated schema for package.json needs to be fixed #210

@isabellachen

Description

@isabellachen

Using the online schema to typescript coverter with the package.json schema I get a scripts? prop under CoreProperties with a list of optional props (I removed most of the props for brevity)

scripts?: {
    prepublish?: string;
    prepare?: string;
    prepublishOnly?: string;
    [k: string
    ]: string;
}

My compiler is freaking out because Property 'prepublish' of type 'string | undefined' is not assignable to string index type 'string'. The same goes for the entire list of props. To get around this issue, I had to change the last two lines to:

scripts?: {
    prepublish?: string;
    prepare?: string;
    prepublishOnly?: string;
    [k: string
    ]: string | undefined;
}

And it worked fine.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions