Typescript Type definition for Graphql-playground-html mismatching
See original GitHub issueI am running into an issue with TS type definitions for graphql-playground-html. I have checked that all my Apollo npm packages are up to date to the latest 2.6.2 version.
Intended outcome:
I want to specify settings
in for Playground as described by the Apollo doc.
Specifically, I want to define configs related to schema.polling
I have my settings like this, which is taken from the Graphql-playground doc. It’s also what I see when I open my iGraphql playground’s Settings.
playground: {
settings: {
"editor.cursorShape": "line" as CursorShape,
"editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace",
"editor.fontSize": 14,
"editor.reuseHeaders": true,
"editor.theme": "dark" as Theme,
"general.betaUpdates": false,
"prettier.printWidth": 80,
"prettier.tabWidth": 2,
"prettier.useTabs": false,
"request.credentials": "omit",
"schema.disableComments": true,
"schema.polling.enable": false,
"schema.polling.endpointFilter": "*localhost*",
"schema.polling.interval": 2000,
"tracing.hideTracingResponse": true,
"queryPlan.hideQueryPlanResponse": true
},
...
I expected my app to compile and take in the new settings every time I start my dev server.
Actual outcome:
However, when I compile my app, I get a TS error:
Object literal may only specify known properties, and ''schema.disableComments'' does not exist in type 'ISettings'.
I then looked at the actual type definition imported with apollo-server from
@apollographql/graphql-playground-html/dist/render-playground-page
and I see the actual definition ISettings
is missing more fields as compared to Graphql-playground’s settings interface:
export interface ISettings {
'general.betaUpdates': boolean;
'editor.cursorShape': CursorShape;
'editor.theme': Theme;
'editor.reuseHeaders': boolean;
'tracing.hideTracingResponse': boolean;
'queryPlan.hideQueryPlanResponse'?: boolean;
'editor.fontSize': number;
'editor.fontFamily': string;
'request.credentials': string;
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top GitHub Comments
Unsure why this is closed - the types are certainly still out of sync with the playground…
Is enough to make TS complain:
Edit: casting
as Config as any
solved it for now