Code Monkey home page Code Monkey logo

Comments (2)

Quramy avatar Quramy commented on May 29, 2024

I agree "adding more complex tag pattern" .

Because some GraphQL clients don't use template literal tag function.

For example, with octokit/graphql.js :

const { repository } = await graphql(
  `
    {
      repository(owner: "octokit", name: "graphql.js") {
        issues(last: 3) {
          edges {
            node {
              title
            }
          }
        }
      }
    }
  `,
  {
    headers: {
      authorization: `token secret123`,
    },
  }
);

But I will not care TypeScript Template Literal Types pattern (e.g. Query<"query { data }"> ).

But I will not use this in my plugin because I think lexing / parsing queries should be responsible for graphql-js . And recursive descent parser with string type literal can exceed TypeScript's recursive type limitation.

#117 (comment)

from ts-graphql-plugin.

aspirisen avatar aspirisen commented on May 29, 2024

@Quramy about

But I will not care TypeScript Template Literal Types pattern (e.g. Query<"query { data }"> ).

I don't mean to actually infer type or whatever, just when you specify the pattern do not ignore ts types if they are matched by the pattern. I.e. here type Data = Query<'query { data }'> there is no some predefined Query type that cause some special behavior of ts-graphql-plugin. So as i understand the task of the plugin is match part of the file text, parse it as GraphQL and provide autocomplete.

So yes, i agree that this plugin should not provide some types inference out of the box, but delegate it to some other third party libraries. However, it would be good to have autocomplete in such cases

from ts-graphql-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.