Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions compiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type User { name: String }
==================================== OUTPUT ===================================
//- __generated__/barFragment.graphql.ts
/**
* <auto-generated> SignedSource<<a5582a367491356203d24b1d632b3ee0>>
* <auto-generated> SignedSource<<f592d795251b0c88f6e5456bd47a8d10>>
* @lightSyntaxTransform
* @nogrep
*/
Expand All @@ -36,6 +36,7 @@ type User { name: String }

import { ReaderFragment } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
import { foo as userFooResolverType } from "../foo";
export type barFragment$data = {
readonly foo: ReturnType<typeof userFooResolverType> | null | undefined;
readonly " $fragmentType": "barFragment";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type User { name: String }
==================================== OUTPUT ===================================
//- __generated__/barFragment.graphql.ts
/**
* <auto-generated> SignedSource<<994f768bf6dd6a6640e8f84b68699086>>
* <auto-generated> SignedSource<<5dff27df4f02d14a44779d79d3f98fbb>>
* @lightSyntaxTransform
* @nogrep
*/
Expand All @@ -39,6 +39,8 @@ type User { name: String }

import { ReaderFragment } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
import { foo as userFooResolverType } from "../foo";
import { ITestResolverContextType } from "@test/package";
export type barFragment$data = {
readonly foo: ReturnType<ReturnType<typeof userFooResolverType>["read"]> | null | undefined;
readonly " $fragmentType": "barFragment";
Expand Down
8 changes: 2 additions & 6 deletions compiler/crates/relay-typegen/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ pub(crate) fn write_operation_type_exports_section(
write_import_custom_type(custom_error_import, writer)?;
}
// TODO: Add proper support for Resolver type generation in typescript: https://github.com/facebook/relay/issues/4772
if typegen_context.project_config.typegen_config.language == TypegenLanguage::Flow {
write_relay_resolver_imports(imported_resolvers, writer)?;
}
write_relay_resolver_imports(imported_resolvers, writer)?;
write_split_raw_response_type_imports(typegen_context, imported_raw_response_types, writer)?;

let mut input_object_types = IndexMap::default();
Expand Down Expand Up @@ -468,9 +466,7 @@ pub(crate) fn write_fragment_type_exports_section(
runtime_imports.write_runtime_imports(writer)?;

// TODO: Add proper support for Resolver type generation in typescript: https://github.com/facebook/relay/issues/4772
if typegen_context.project_config.typegen_config.language == TypegenLanguage::Flow {
write_relay_resolver_imports(imported_resolvers, writer)?;
}
write_relay_resolver_imports(imported_resolvers, writer)?;

let refetchable_metadata = RefetchableMetadata::find(&fragment_definition.directives);
let fragment_type_name = format!("{}$fragmentType", fragment_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export type User__pop_star_name$normalization = {
};
-------------------------------------------------------------------------------
import type { FragmentRefs } from "relay-runtime";
import userPopStarNameResolverType from "PopStarNameResolver";
export type Foo_user$data = {
readonly poppy: {
readonly name: string | null | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type User__pop_star_name$normalization = {
};
-------------------------------------------------------------------------------
import type { FragmentRefs } from "relay-runtime";
import userPopStarNameResolverType from "PopStarNameResolver";
export type Foo_user$data = {
readonly poppy: {
readonly name: string | null | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extend type User {
}
==================================== OUTPUT ===================================
import { FragmentRefs } from "relay-runtime";
import userPopStarNameResolverType from "PopStarNameResolver";
export type Foo_user$data = {
readonly poppy: NonNullable<ReturnType<typeof userPopStarNameResolverType>>;
readonly " $fragmentType": "Foo_user";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extend type User {
}
==================================== OUTPUT ===================================
import { FragmentRefs } from "relay-runtime";
import userPopStarNameResolverType from "PopStarNameResolver";
export type Foo_user$data = {
readonly poppy: ReturnType<typeof userPopStarNameResolverType> | null | undefined;
readonly " $fragmentType": "Foo_user";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type ClientEdgeQuery_MyFragment_best_friend = {
};
-------------------------------------------------------------------------------
import { FragmentRefs, DataID } from "relay-runtime";
import clientUserBestFriendResolverType from "bar";
export type MyFragment$data = {
readonly best_friend: {
readonly name: string | null | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type ClientUser__blob$normalization = {
};
-------------------------------------------------------------------------------
import { FragmentRefs } from "relay-runtime";
import clientUserBlobResolverType from "bar";
export type MyFragment$data = {
readonly blob: {
readonly data: string | null | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type ClientUser {
}
==================================== OUTPUT ===================================
import { FragmentRefs } from "relay-runtime";
import clientUserNameResolverType from "bar";
export type MyFragment$data = {
readonly name: NonNullable<ReturnType<typeof clientUserNameResolverType>>;
readonly " $fragmentType": "MyFragment";
Expand Down