fix(ui): repair typescript definitions

pull/5898/head
Pavel Zavora 2022-03-31 16:10:24 +02:00
parent ebd0c32785
commit 5d7679a442
2 changed files with 23 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import React, {PureComponent} from 'react' import React, {PureComponent} from 'react'
import {connect} from 'react-redux' import {connect, ResolveThunks} from 'react-redux'
import AnnotationEditor from 'src/shared/components/AnnotationEditor' import AnnotationEditor from 'src/shared/components/AnnotationEditor'
@ -14,8 +14,10 @@ import {notifyErrorWithAltText} from 'src/shared/copy/notifications'
import {Annotation} from 'src/types' import {Annotation} from 'src/types'
interface Props { interface ReduxStateProps {
editingAnnotation?: Annotation editingAnnotation?: Annotation
}
interface ReduxDispatchProps {
onSetEditingAnnotation: typeof setEditingAnnotation onSetEditingAnnotation: typeof setEditingAnnotation
onDeleteAnnotation: typeof deleteAnnotationAsync onDeleteAnnotation: typeof deleteAnnotationAsync
onSaveAnnotation: typeof updateAnnotationAsync onSaveAnnotation: typeof updateAnnotationAsync
@ -23,6 +25,7 @@ interface Props {
onNotify: typeof notify onNotify: typeof notify
} }
type Props = ReduxStateProps & ResolveThunks<ReduxDispatchProps>
class AnnotationEditorContainer extends PureComponent<Props> { class AnnotationEditorContainer extends PureComponent<Props> {
public render() { public render() {
const {editingAnnotation} = this.props const {editingAnnotation} = this.props
@ -93,7 +96,7 @@ class AnnotationEditorContainer extends PureComponent<Props> {
const mstp = ({annotations: {annotations, editingAnnotation}}) => { const mstp = ({annotations: {annotations, editingAnnotation}}) => {
return { return {
editingAnnotation: annotations[editingAnnotation], editingAnnotation: annotations[editingAnnotation],
} } as ReduxStateProps
} }
const mdtp = { const mdtp = {

View File

@ -1,21 +1,32 @@
import React, {PureComponent} from 'react' import React, {PureComponent} from 'react'
import {withRouter, WithRouterProps} from 'react-router' import {withRouter, WithRouterProps} from 'react-router'
import {connect} from 'react-redux' import {connect, HandleThunkActionCreator} from 'react-redux'
import uuid from 'uuid' import uuid from 'uuid'
import {updateTagFilterAsync} from 'src/shared/actions/annotations' import {updateTagFilterAsync} from 'src/shared/actions/annotations'
import {AnnotationTags, TagFilterType} from 'src/types/annotations' import {AnnotationTags, TagFilterType} from 'src/types/annotations'
interface Props extends WithRouterProps { interface OwnProps {
tags: AnnotationTags tags: AnnotationTags
annotationsIndexURL: string
onUpdateTagFilterAsync: typeof updateTagFilterAsync
params: { params: {
dashboardID: string dashboardID: string
sourceID: string sourceID: string
} }
} }
type RouterProps = WithRouterProps<{
dashboardID: string
sourceID: string
}>
interface ReduxStateProps {
annotationsIndexURL: string
}
interface ReduxDispatchProps {
onUpdateTagFilterAsync: HandleThunkActionCreator<typeof updateTagFilterAsync>
}
type Props = OwnProps & RouterProps & ReduxStateProps & ReduxDispatchProps
class AnnotationTagsDropdown extends PureComponent<Props> { class AnnotationTagsDropdown extends PureComponent<Props> {
public render() { public render() {
@ -57,7 +68,7 @@ class AnnotationTagsDropdown extends PureComponent<Props> {
} }
} }
const mstp = (state, ownProps) => { const mstp = (state: any, ownProps: any) => {
const {sourceID} = ownProps.params const {sourceID} = ownProps.params
const source = state.sources.find(s => (s.id = sourceID)) const source = state.sources.find(s => (s.id = sourceID))
@ -67,7 +78,7 @@ const mstp = (state, ownProps) => {
return { return {
annotationsIndexURL: source.links.annotations, annotationsIndexURL: source.links.annotations,
} } as ReduxStateProps
} }
const mdtp = { const mdtp = {