You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a file generated in my project with, relay 18.1.0 and "useImportTypeSyntax": true in relay.config.json
// MediaCover_media.graphql.tsimporttype{ReaderFragment}from'relay-runtime';importtype{FragmentRefs}from"relay-runtime";importtype{srcasmediaCoverImageSrcResolverType}from"../lib/media/src";// Type assertion validating that `mediaCoverImageSrcResolverType` resolver is correctly implemented.// A type error here indicates that the type signature of the resolver module is incorrect.(mediaCoverImageSrcResolverTypesatisfies(rootKey: src_mediaCover$key,args: {extraLarge: boolean|null|undefined;large: boolean|null|undefined;},)=>string|null|undefined);
This code leads to runtime error ReferenceError: mediaCoverImageSrcResolverType is not defined
It happens because (mediaCoverImageSrcResolverType satisfies ... is transpiled to mediaCoverImageSrcResolverType by typescript
but import type { src as mediaCoverImageSrcResolverType } from "../lib/media/src"; gets dropped at runtime
It's not possible to use satisfies between two types, only a value and a type.
The solution is to make this import without type keyword
This is a file generated in my project with, relay 18.1.0 and
"useImportTypeSyntax": true
inrelay.config.json
This code leads to runtime error
ReferenceError: mediaCoverImageSrcResolverType is not defined
It happens because
(mediaCoverImageSrcResolverType satisfies ...
is transpiled tomediaCoverImageSrcResolverType
by typescriptbut
import type { src as mediaCoverImageSrcResolverType } from "../lib/media/src";
gets dropped at runtimeIt's not possible to use
satisfies
between twotypes
, only avalue
and atype
.The solution is to make this import without
type
keywordRelated to: #4797 #4772
The text was updated successfully, but these errors were encountered: