detrohutt/babel-plugin-import-graphql

Provide d.ts as part of lib

JustFly1984 opened this issue · 2 comments

There is no @types/babel-plugin-import-graphql

I've tried to generate .d.ts with dts-gen, but it produces empty file.

I use this with a typescript project I'm working on and haven't needed types for it since it's only used indirectly at compile time. Are you getting any kind of warnings?

Yes, I do get warnings. I'm using it as

// @ts-ignore
import { requireGql } from 'babel-plugin-import-graphql/build/requireGql'

we are using aws-amplify, but now limiting it to only auth, and disabled their outdated graphql

and in gatsby 
```jsx
const createPages = async ({ actions: { createPage } }: CreatePagesArgs) => {
  const { getHome } = requireGql(path.resolve('./src/graphql/user.gql'))

  const query = print(getHome)

  const url = `${getEndpoint('user')}/graphql-incognito`

  console.log('url: ', url)

  return fetch(url, {
    method: 'post',
    headers: {
      'Access-Control-Allow-Origin': '*',
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      query
    })
  }).then((response: any) =>
    response.json()
  ).then((result: any) => {
    console.error(result)
    if (
      result.data === undefined ||
      result.errors !== undefined
    ) {
      throw result.errors
    }

This is the only place in whole project I use @ts-ignore