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

View File

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