Relay-compiler-language-typescript: Duplicate imports of relay-runtime

Created on 10 Nov 2019  路  6Comments  路  Source: relay-tools/relay-compiler-language-typescript

Check this

import { ConcreteRequest } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type HomeRootIssuesQueryVariables = {
    owner: string;
    name: string;
};
export type HomeRootIssuesQueryResponse = {
    readonly repository: {
        readonly " $fragmentRefs": FragmentRefs<"Issues_repository">;
    } | null;
};
export type HomeRootIssuesQuery = {
    readonly response: HomeRootIssuesQueryResponse;
    readonly variables: HomeRootIssuesQueryVariables;
};

It would be nice if these two imports

import { ConcreteRequest } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";

were just one

import { ConcreteRequest, FragmentRefs } from "relay-runtime";
bug enhancement

Most helpful comment

Okay, I'll tackle this today

All 6 comments

this is actually more than superficial; in my case it's causing typescript compiler errors because enums are exported before the 2nd relay-runtime import which causes Line 5:1: Import in body of module; reorder to top import/first"

Could you give more details with snippets or a repro?

I have the same problem with @chrisdostert.
It seems to be happening when using Enum.

import { ReaderFragment } from "relay-runtime";
export type HogeTypeEnum = "foo" | "bar" | "%future added value";
// Line 5:1:  Import in body of module; reorder to top  import/first
import { FragmentRefs } from "relay-runtime";
export type Hoge_query = {
    readonly hoge: {
        readonly type: HogeTypeEnum;
        ...
    }
}

Okay, I'll tackle this today

@renanmav can we close this ticket now?

Well, not yet. ReaderFragment isn鈥檛 being aggregated on #160. I鈥檒l investigate further soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alloy picture alloy  路  21Comments

artola picture artola  路  14Comments

sgwilym picture sgwilym  路  7Comments

mrtnzlml picture mrtnzlml  路  6Comments

renanmav picture renanmav  路  11Comments