Skip to content

Commit 47af754

Browse files
committed
✨ - Tagged template literal support
1 parent 30595cc commit 47af754

File tree

89 files changed

+4111
-2113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+4111
-2113
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
We've found a bug for you!
3+
snapshot_tests/operations/errors/fragmentTemplateTagNotFound.res:11:3-15:3
4+
5+
9 │
6+
10 │ %graphql(`
7+
11 │ query MyQuery @ppxConfig(templateTag: "gql", templateTagReturnType: "
8+
│ bool") {
9+
12 │  lists {
10+
13 │  ...ListFragment
11+
14 │  }
12+
15 │  }
13+
16 │ `)
14+
17 │
15+
16+
The value gql can't be found
17+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
We've found a bug for you!
3+
snapshot_tests/operations/errors/fragmentTemplateTagWrongType.res:11:10-21
4+
5+
9 │ query MyQuery @ppxConfig(templateTagLocation: "gql", templateTagRetur
6+
│ nType: "bool") {
7+
10 │ lists {
8+
11 │ ...ListFragment
9+
12 │ }
10+
13 │ }
11+
14 │ `)
12+
13+
This array item has type: string
14+
But this array is expected to have items of type: bool
15+
16+
Arrays can only contain items of the same type.
17+
18+
Possible solutions:
19+
- Convert all values in the array to the same type.
20+
- Use a tuple, if your array is of fixed length. Tuples can mix types freely, and compiles to a JavaScript array. Example of a tuple: `let myTuple = (10, "hello", 15.5, true)
21+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
We've found a bug for you!
3+
snapshot_tests/operations/errors/fragmentTemplateTagWrongTypeOnFragment.res:11:8-24
4+
5+
9 │ fragment ListFragment on Lists @ppxConfig(templateTagLocation: "gql"
6+
│ , templateTagReturnType: "bool") {
7+
10 │ nullableOfNullable
8+
11 │ ...ListFragmentInner
9+
12 │ }
10+
13 │ `)
11+
14 │
12+
13+
This array item has type: string
14+
But this array is expected to have items of type: bool
15+
16+
Arrays can only contain items of the same type.
17+
18+
Possible solutions:
19+
- Convert all values in the array to the same type.
20+
- Use a tuple, if your array is of fixed length. Tuples can mix types freely, and compiles to a JavaScript array. Example of a tuple: `let myTuple = (10, "hello", 15.5, true)
21+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
We've found a bug for you!
3+
snapshot_tests/operations/errors/fragmentTemplateTagWrongTypeOnFragmentReverse.res:11:8-24
4+
5+
9 │ fragment ListFragment on Lists {
6+
10 │ nullableOfNullable
7+
11 │ ...ListFragmentInner
8+
12 │ }
9+
13 │ `)
10+
14 │
11+
12+
This has type: bool
13+
But this function argument is expecting: string
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
We've found a bug for you!
3+
snapshot_tests/operations/errors/fragmentTemplateTagWrongTypeReverse.res:11:10-21
4+
5+
9 │ query MyQuery {
6+
10 │ lists {
7+
11 │ ...ListFragment
8+
12 │ }
9+
13 │ }
10+
14 │ `)
11+
12+
This has type: bool
13+
But this function argument is expecting: string
14+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
We've found a bug for you!
3+
snapshot_tests/operations/errors/fragmentTemplateTagWrongTypes.res:19:10-26
4+
5+
17 │ lists {
6+
18 │ ...ListFragment
7+
19 │ ...ListFragmentWrong
8+
20 │ }
9+
21 │ }
10+
22 │ `)
11+
12+
This array item has type: string
13+
But this array is expected to have items of type: bool
14+
15+
Arrays can only contain items of the same type.
16+
17+
Possible solutions:
18+
- Convert all values in the array to the same type.
19+
- Use a tuple, if your array is of fixed length. Tuples can mix types freely, and compiles to a JavaScript array. Example of a tuple: `let myTuple = (10, "hello", 15.5, true)
20+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
%graphql(`
2+
fragment ListFragment on Lists {
3+
nullableOfNullable
4+
nullableOfNonNullable
5+
}
6+
`)
7+
8+
module WrongFragmentName = ListFragment
9+
10+
%graphql(`
11+
query MyQuery @ppxConfig(templateTag: "gql", templateTagReturnType: "bool") {
12+
lists {
13+
...ListFragment
14+
}
15+
}
16+
`)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%graphql(`
2+
fragment ListFragment on Lists {
3+
nullableOfNullable
4+
nullableOfNonNullable
5+
}
6+
`)
7+
8+
%graphql(`
9+
query MyQuery @ppxConfig(templateTagLocation: "gql", templateTagReturnType: "bool") {
10+
lists {
11+
...ListFragment
12+
}
13+
}
14+
`)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
%graphql(`
2+
fragment ListFragmentInner on Lists {
3+
nullableOfNullable
4+
nullableOfNonNullable
5+
}
6+
`)
7+
8+
%graphql(`
9+
fragment ListFragment on Lists @ppxConfig(templateTagLocation: "gql", templateTagReturnType: "bool") {
10+
nullableOfNullable
11+
...ListFragmentInner
12+
}
13+
`)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
%graphql(`
2+
fragment ListFragmentInner on Lists @ppxConfig(templateTagLocation: "gql", templateTagReturnType: "bool") {
3+
nullableOfNullable
4+
nullableOfNonNullable
5+
}
6+
`)
7+
8+
%graphql(`
9+
fragment ListFragment on Lists {
10+
nullableOfNullable
11+
...ListFragmentInner
12+
}
13+
`)

0 commit comments

Comments
 (0)