Open geongeorge opened 5 months ago
Hi @geongeorge, thank you for opening this issue. I've put it in the backlog so that my team can consider it.
Hi @matteodepalo Because module resolution is not node in the remix app, I'm not able to import types for shopify resources as well from the api. I cannot get the Theme, Product, Etc type from this package as well.
export async function getJobs(shopName: string, themes: Theme) {
...
}
I managed to extract the types from the shopify.server.ts file like so. Using it in our custom starter:
/* Getting types */
export type AdminMain = Awaited<ReturnType<typeof authenticate.admin>>;
export type AdminApiContext = AdminMain["admin"];
export type AdminApiSession = AdminMain["session"];
export type AdminGraphqlClient = AdminApiContext["graphql"];
export type AdminRestClient = AdminApiContext["rest"];
We're labeling this issue as stale because there hasn't been any activity on it for 60 days. While the issue will stay open and we hope to resolve it, this helps us prioritize community requests.
You can add a comment to remove the label if it's still relevant, and we can re-evaluate it.
This has been very frustrating. I was trying to adapt your starter QRCode example from JavaScript to TypeScript, and it means I need types that simply are not exposed from the package. https://shopify.dev/docs/apps/getting-started/build-qr-code-app
I guess #879 solved this issue as you can now do:
import type { AdminGraphqlClient, AdminRestClient } from "@shopify/shopify-app-remix/server";
export async function loader({ request }: LoaderFunctionArgs) {
const { admin, session } = await authenticate.admin(request);
admin.rest as AdminRestClient;
admin.graphql as AdminGraphqlClient;
...
}
I had a similar issue with accessing "AdminApiContext" and importing it via @shopify/shopify-app-remix/server
fixed it for me.
Overview/summary
I want to pass my admin rest or graphql api client in a seperate server file in remix js. But the types are not exposed.
I want to do something like this in another file but I do not see any export from the library for
RestClient
orGraphqlClients
Note
If this is a generic type which is generated when running
shopifyApp({..})
It will be also great if this can be accessed through the returned object so I can reexport from theshopify.server.ts
file