Skip to content

Commit

Permalink
fix: fix generator for Nullable type
Browse files Browse the repository at this point in the history
  • Loading branch information
pviti committed Apr 10, 2024
1 parent ec89120 commit fc7507a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gen/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ const templatedComponent = (res: string, name: string, cmp: Component): { compon
}

rels.push(`${r.name}${r.required ? '' : '?'}: ${r.required ? resName : nullable(resName)}`)
nullables ||= !r.required

}
})
Expand All @@ -954,7 +955,6 @@ const templatedComponent = (res: string, name: string, cmp: Component): { compon
component = component.replace(/##__RESOURCE_MODEL_FIELDS__##/g, fieldsStr)
component = component.replace(/##__RESOURCE_MODEL_RELATIONSHIPS__##/g, relsStr)


return { component, models, enums, nullables }

}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/memberships.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import type { Nullable } from '../types'
import type { Nullable } from '../types'
import { ApiResource } from '../resource'
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse, ResourceSort, /* ResourceFilter */ } from '../resource'
import type { QueryParamsRetrieve, QueryParamsList } from '../query'
Expand Down

0 comments on commit fc7507a

Please sign in to comment.