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

Argument of type 'Config' is not assignable to parameter of type 'CompletedConfig' in ts-json-schema-generator 2.0.0 #1918

Closed
danmichaelo opened this issue Apr 13, 2024 · 2 comments · Fixed by #1919

Comments

@danmichaelo
Copy link

After upgrading to ts-json-schema-generator 2.0.0, I got an error when initializing the generator programmatically:

const schemaGenerator = createGenerator({
    path: sourcePath,
    tsconfig: tsconfigPath,
    type: "*",
    encodeRefs: false,
  });
Argument of type '{ path: string; tsconfig: string; type: string; encodeRefs: false; }' is not assignable to parameter of type 'CompletedConfig'.
  Type '{ path: string; tsconfig: string; type: string; encodeRefs: false; }' is missing the following properties from type 'Omit<Required<Config>, "path" | "type" | "schemaId" | "tsconfig">': minify, expose, topRef, jsDoc, and 8 more.ts(2345)

It works if I add all the properties, but I'm not sure if this change was intentional?

(Typescript: 5.4.5)

@domoritz
Copy link
Member

I thought it would be cleaner to expect full configs in some of the initialization methods but I think it makes sense to support partial configs in createGenerator. I sent a patch and will release it in a bit.

Copy link

🚀 Issue was released in v2.0.1-next.0 🚀

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

Successfully merging a pull request may close this issue.

2 participants