Created
June 18, 2018 21:45
-
-
Save jurosh/159b2cfc9cef185c0a12f1b2ad69b589 to your computer and use it in GitHub Desktop.
VSCode GRAPHQL integration - example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| import gql from 'graphql-tag'; | |
| import { Query } from 'react-apollo'; | |
| import { GetSystemLogsQuery } from '../generated/schema'; | |
| const GET_SYSTEM_LOGS = gql` | |
| query GetSystemLogs { | |
| system { | |
| logs // INTELISENSE NOT WORKING HERE :( | |
| } | |
| } | |
| `; | |
| class GetGetSystemLogs extends Query<GetSystemLogsQuery> {} | |
| const SystemLogsScreen = () => ( | |
| <div> | |
| <h1>System Logs</h1> | |
| <GetGetSystemLogs query={GET_SYSTEM_LOGS} fetchPolicy="cache-first"> | |
| {({ loading, error, data }) => | |
| data && data.system ? ( | |
| <pre>{data.system.logs}</pre> | |
| ) : ( | |
| <div>Loading...</div> | |
| ) | |
| } | |
| </GetGetSystemLogs> | |
| </div> | |
| ); | |
| export default SystemLogsScreen; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "ts-graphql-plugin": "^1.1.2", | |
| "typescript": "^2.8.3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| "outDir": "build/dist", | |
| "module": "esnext", | |
| "target": "es5", | |
| "lib": ["es6", "dom", "esnext.asynciterable"], | |
| "sourceMap": true, | |
| "allowJs": true, | |
| "jsx": "react", | |
| "moduleResolution": "node", | |
| "rootDir": "src", | |
| "forceConsistentCasingInFileNames": true, | |
| "noImplicitReturns": true, | |
| "noImplicitThis": false, | |
| "noImplicitAny": false, | |
| "strictNullChecks": true, | |
| "suppressImplicitAnyIndexErrors": true, | |
| "noUnusedLocals": true | |
| }, | |
| "exclude": [ | |
| "node_modules", | |
| "build", | |
| "scripts", | |
| "acceptance-tests", | |
| "webpack", | |
| "jest", | |
| "src/setupTests.ts" | |
| ], | |
| "plugins": [ | |
| { | |
| "name": "ts-graphql-plugin" | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment