You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,19 @@ async function main() {
105
105
main()
106
106
```
107
107
108
+
### Using vanilla JavaScript instead of TypeScript
109
+
110
+
GraphClient CLI generates the client artifacts as TypeScript files by default but you can configure CLI to generate JavaScript and JSON files together with additional TypeScript definition files by using `--fileType js` or `--fileType json`.
111
+
112
+
`js` flag generates all files as JavaScript files with ESM Syntax and `json` flag generates source artifacts as JSON files while entrypoint JavaScript file with old CommonJS syntax because only CommonJS supports JSON files as modules.
113
+
114
+
Unless you use CommonJS(`require`) specifically, we'd recommend you to use `js` flag.
115
+
116
+
`graphclient --fileType js`
117
+
118
+
-[An example for JavaScript usage in CommonJS syntax with JSON files](/examples/javascript-cjs/)
119
+
-[An example for JavaScript usage in ESM syntax](/examples/javascript-esm/)
120
+
108
121
#### The Graph Client DevTools
109
122
110
123
The Graph Client CLI comes with a built-in GraphiQL so you can experiemnt with queries in real time.
0 commit comments