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

package definition errors #88

Closed
G-Rath opened this issue May 16, 2019 · 9 comments
Closed

package definition errors #88

G-Rath opened this issue May 16, 2019 · 9 comments

Comments

@G-Rath
Copy link

G-Rath commented May 16, 2019

I don't know the proper place to make this issue, as I don't know where the actual fault lies.

The typings for package are not compilable, due to this block at the end of the main interface:

[k: string]: {
[k: string]: any;
};

It should have | any at the end, to support top level properties that are primitive types (such as module, esnext, etc).

This is also the same for this line:

[k: string]: string;

@ffflorian
Copy link
Owner

Hi @G-Rath, thanks for the info. I'll have a look!

@G-Rath
Copy link
Author

G-Rath commented Jun 11, 2019

Any update on this?

When I generate the schema here (which is apparently also using json-schema-to-typescript, like this repo), it doesn't generate the same output; notably it just has [k: string]: any; at the end. (it does still put [k: string]: string; for line 231).

Interesting using the repo own hosted version of the library gives something more similar to what this repo has, except [k: string]: any; instead of the [k: string]: { [k: string]: any; }.

If theres anything I can do to help speed this issue along, let me know :)

@ffflorian
Copy link
Owner

@G-Rath
I rebuilt all schemas and there were no changes for package, so AFAIC I can't do anything about the wrong definition file.

I am using json-schema-to-typescript version 6.1.3 while transform.now.sh uses version 4.6.5 (and the hosted site might use a different version, too).

Could you please open an issue at https://github.com/bcherny/json-schema-to-typescript/issues and link this issue here? Thanks!

@G-Rath
Copy link
Author

G-Rath commented Jun 13, 2019

Bugger, seems there already is one: bcherny/json-schema-to-typescript#201

@G-Rath
Copy link
Author

G-Rath commented Jul 5, 2019

So I made a PR updating the schema so that the types should now be correctly generated, which has been merge.

I think all that's left is to regenerate the typescript definitions & publish them?

@ffflorian
Copy link
Owner

ffflorian commented Jul 5, 2019

@G-Rath unfortunately there is no new version on npm yet. As soon as there is a new version out, I will re-build all schema files.

Sorry, I misunderstood your comment. I will re-generate the schemas now.

@ffflorian
Copy link
Owner

@schemastore/package 0.0.4 was just published.

@G-Rath
Copy link
Author

G-Rath commented Jul 13, 2019

@ffflorian awesome, thanks!

Don't forget to push - the commits are not on github yet ;)
(but I can confirm that the package now compiles properly)


Just as a general heads up, there are more schema typings like this, and at least a couple that are invalid for other reasons (off the top of my head, arvo is invalid b/c it has a circular type definition).

The problem w/ the generator should hopefully be solved once I get around to implementing the --strictIndexSignatures in the JS2T package.

I think it could be valuable if schemastore-updater supported checking the generated schemas - even just a function that chucks each definition file into the ts compiler and logging the errors would give enough information to go on.

Let me know if you'd be interested in taking this further w/ me - while the core of schemastore-updater is pretty much feature-complete for its primary purpose, I think it could easily help expose places for improvement in both JS2T & the schemas on the store 😄

@G-Rath G-Rath closed this as completed Jul 13, 2019
@ffflorian
Copy link
Owner

Don't forget to push - the commits are not on github yet ;)

Thanks for reminding me :) I just re-built all packages and commited them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants