question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[redux-saga-requests-graphql]Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string'.

See original GitHub issue

Typescript seems to be crying when I try to use “gql” from “redux-saga-requests-graphql” Can be resolved by adding “TemplateStringsArray” as a possible type for “gql” arguments. Pull request in progress

btw, your lib rocks

ERROR in /<<workspace>>/actions.tsx(7,15):
7:15 Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string'.
     5 |   type: anAction,
     6 |   request: {
  >  7 |     query: gql`
       |               ^
     8 |       {
     9 |         a request

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
klis87commented, Jan 30, 2020

I tried this:

gql`
  query{
    obj {
      id ${'1'} ${2}
    }
  }
`;

I believe the correct type is actually

export const gql: (
  query: TemplateStringsArray,
  ...args: (string | number)[]
) => string;

As some people like to have dynamic queries, even though only static ones are officially recommended

0reactions
klis87commented, Mar 22, 2020

@fhourdin merged in newest version

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: Tagged Template Literals shows Error
In toString method, typescript is showing me following error. Argument of type 'TemplateStringsArray' is not assignable to parameter of type ' ...
Read more >
Argument of type 'TemplateStringsArray' is not assignable to ...
I am getting the Typescript error message. Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string'.ts(2345).
Read more >
Documentation - Template Literal Types - TypeScript
Template literal types build on string literal types, and have the ability to ... Argument of type '"firstName"' is not assignable to parameter...
Read more >
Argument of type 'string' is not assignable to parameter of type
The React component works fine and displays the right icon based on the string it receives back from the API based on my...
Read more >
Template literals (Template strings) - JavaScript | MDN
However, a tagged template literal may not result in a string; ... If specified, it will be called with the template strings array...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found