Skip to content

Commit

Permalink
feat(core): add optional flag to force number type instead of bigint (#…
Browse files Browse the repository at this point in the history
…841)

* feat(core): add optional flag to force number type instead of bigint

* refactor(core): rename flag to useBigInt and refactored the logic
  • Loading branch information
GBDev13 committed Apr 25, 2023
1 parent c335f00 commit a2798af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/getters/scalar.ts
Expand Up @@ -28,7 +28,10 @@ export const getScalar = ({
switch (item.type) {
case 'number':
case 'integer': {
let value = item.format === 'int64' ? 'bigint' : 'number';
let value =
item.format === 'int64' && context.override.useBigInt
? 'bigint'
: 'number';
let isEnum = false;

if (item.enum) {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types.ts
Expand Up @@ -100,6 +100,7 @@ export type NormalizedOverrideOutput = {
useDates?: boolean;
useTypeOverInterfaces?: boolean;
useDeprecatedOperations?: boolean;
useBigInt?: boolean;
};

export type NormalizedMutator = {
Expand Down Expand Up @@ -278,6 +279,7 @@ export type OverrideOutput = {
useDates?: boolean;
useTypeOverInterfaces?: boolean;
useDeprecatedOperations?: boolean;
useBigInt?: boolean;
};

export type OverrideOutputContentType = {
Expand Down

1 comment on commit a2798af

@vercel
Copy link

@vercel vercel bot commented on a2798af Apr 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.