From 82f9ee64830a4dcaf0eeb9d7f4102fec4c837a36 Mon Sep 17 00:00:00 2001 From: Ola Okelola <10857143+lolopinto@users.noreply.github.com> Date: Mon, 13 Jan 2025 23:28:51 -0800 Subject: [PATCH] fix 1864 (#1873) --- examples/simple/src/schema/patterns/contact_info.ts | 5 +++++ internal/tscode/base.tmpl | 3 +++ 2 files changed, 8 insertions(+) diff --git a/examples/simple/src/schema/patterns/contact_info.ts b/examples/simple/src/schema/patterns/contact_info.ts index b70630bde..fda270333 100644 --- a/examples/simple/src/schema/patterns/contact_info.ts +++ b/examples/simple/src/schema/patterns/contact_info.ts @@ -16,6 +16,11 @@ export default class ContactInfo implements Pattern { tsType: "ContactInfoExtra", graphQLType: "ContactInfoExtra", nullable: true, + // privacyPolicy: { + // // To test generation of privacy policies in patterns + // rules: [AlwaysAllowRule], + // this is disabled because there's a bug with custom inputs exposing `_extra` instead of `extra` + // }, fields: { // e.g. default email or phone number default: BooleanType(), diff --git a/internal/tscode/base.tmpl b/internal/tscode/base.tmpl index 8b9e5e24a..dff302867 100644 --- a/internal/tscode/base.tmpl +++ b/internal/tscode/base.tmpl @@ -183,6 +183,9 @@ implements {{useImport "Ent"}}<{{$viewerType}}> {{$node := .Node}} {{range $field := .FieldInfo.EntFields -}} {{ if $field.HasAsyncAccessor $cfg -}} + {{ range $field.GetTsTypeImports -}} + {{$typ := useImportMaybe .Import -}} + {{end -}} async {{$field.TSPublicAPIName}}(): Promise<{{$field.TsType}}> { {{ $fieldName := $field.TsFieldName $cfg -}} {{ if $field.FetchOnDemand -}}