Last active
August 5, 2020 20:26
-
-
Save stevenvachon/e5dd03149d31cf337fa607274ab8d586 to your computer and use it in GitHub Desktop.
TypeScript TS2515 error
This file contains 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
ERROR in /grafana/packages/grafana-toolkit/test/fixtures/plugin/src/module.tsx | |
ERROR in /grafana/packages/grafana-toolkit/test/fixtures/plugin/src/module.tsx(11,44): | |
TS2344: Type 'DataSource' does not satisfy the constraint 'DataSourceApi<DataQuery, DataSourceJsonData>'. | |
Types of property 'query' are incompatible. | |
Type '(request: DataQueryRequest<DataQuery>) => Observable<DataQueryResponse>' is not assignable to type '(request: DataQueryRequest<DataQuery>) => Promise<DataQueryResponse> | Observable<DataQueryResponse>'. | |
Types of parameters 'request' and 'request' are incompatible. | |
Type 'import("/grafana/packages/grafana-toolkit/node_modules/@grafana/data/types/datasource").DataQueryRequest<import("/grafana/packages/grafana-toolkit/node_modules/@grafana/data/types/datasource").DataQuery>' is not assignable to type 'import("/grafana/packages/grafana-data/src/types/datasource").DataQueryRequest<import("/grafana/packages/grafana-toolkit/node_modules/@grafana/data/types/datasource").DataQuery>'. | |
Types of property 'intervalMs' are incompatible. | |
Type 'number | undefined' is not assignable to type 'number'. | |
Type 'undefined' is not assignable to type 'number'. |
This file contains 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 { DataQuery, DataSourceJsonData, DataSourcePlugin } from '@grafana/data'; | |
import { DataSourceWithBackend } from '@grafana/runtime'; | |
import React from 'react'; | |
class DataSource extends DataSourceWithBackend<DataQuery, DataSourceJsonData> {} | |
const ConfigEditor = () => <div />; | |
const MetaInspector = () => <div />; | |
const QueryEditor = () => <div />; | |
export const plugin = new DataSourcePlugin<DataSource, DataQuery, DataSourceJsonData>(DataSource) | |
.setConfigEditor(ConfigEditor) | |
.setQueryEditor(QueryEditor) | |
.setMetadataInspector(MetaInspector); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extending
DataSourceApi
is difficult, complicated and I can't get it to work either: