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

Support bigint #584

Closed
maartenbreddels opened this issue Dec 29, 2023 · 3 comments
Closed

Support bigint #584

maartenbreddels opened this issue Dec 29, 2023 · 3 comments

Comments

@maartenbreddels
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

I used patch-package to patch [email protected] for the project I'm working on; it's an easier way to propose a fix than to open a PR.

I had your tool crash on a bigint, and this seems to solve my problem:

diff --git a/node_modules/typescript-json-schema/dist/typescript-json-schema.js b/node_modules/typescript-json-schema/dist/typescript-json-schema.js
index b230291..e6fb7af 100644
--- a/node_modules/typescript-json-schema/dist/typescript-json-schema.js
+++ b/node_modules/typescript-json-schema/dist/typescript-json-schema.js
@@ -482,6 +482,11 @@ var JsonSchemaGenerator = (function () {
                 definition.properties = {};
                 definition.additionalProperties = true;
             }
+            else if (propertyTypeString === "bigint") {
+                definition.type = "number";
+                definition.properties = {};
+                definition.additionalProperties = false;
+            }
             else {
                 var value = extractLiteralValue(propertyType);
                 if (value !== undefined) {
@@ -558,6 +563,7 @@ var JsonSchemaGenerator = (function () {
                         }
                     }
                 }
+
                 else {
                     var error = new TypeError("Unsupported type: " + propertyTypeString);
                     error.type = propertyType;

I hope this is helpful.

Regards,

Maarten

This issue body was partially generated by patch-package.

@benmusson
Copy link

I had the same issue on 0.63.0, and this solution worked.

@domoritz
Copy link
Collaborator

Please send a pull request if you'd like this feature supported.

@domoritz
Copy link
Collaborator

domoritz commented Apr 5, 2024

Done in #596

@domoritz domoritz closed this as completed Apr 5, 2024
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

3 participants