Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide d.ts as part of lib #55

Open
JustFly1984 opened this issue Mar 2, 2019 · 2 comments
Open

Provide d.ts as part of lib #55

JustFly1984 opened this issue Mar 2, 2019 · 2 comments

Comments

@JustFly1984
Copy link

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

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

@detrohutt
Copy link
Owner

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?

@JustFly1984
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants