Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
isabellachen opened this issue Dec 20, 2018 · 2 comments
Closed

Comments

@isabellachen
Copy link

isabellachen commented Dec 20, 2018

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.

@isabellachen
Copy link
Author

Looks like the index signatures of the other optional properties of optional properties are set to

[k: string
]: any;

@bcherny
Copy link
Owner

bcherny commented Jun 15, 2019

Tracking in #235

@bcherny bcherny closed this as completed Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants