relay-compiler-language-typescript icon indicating copy to clipboard operation
relay-compiler-language-typescript copied to clipboard

Duplicate imports of relay-runtime

Open renanmav opened this issue 6 years ago • 6 comments

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";

renanmav avatar Nov 10 '19 02:11 renanmav

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"

chrisdostert avatar Nov 19 '19 01:11 chrisdostert

Could you give more details with snippets or a repro?

renanmav avatar Nov 19 '19 11:11 renanmav

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;
        ...
    }
}

h-sakano avatar Nov 21 '19 07:11 h-sakano

Okay, I'll tackle this today

renanmav avatar Nov 21 '19 11:11 renanmav

@renanmav can we close this ticket now?

maraisr avatar Dec 10 '19 04:12 maraisr

Well, not yet. ReaderFragment isn’t being aggregated on #160. I’ll investigate further soon.

renanmav avatar Dec 10 '19 11:12 renanmav