Skip to content

Commit

Permalink
fix(types): updates for wrong TS types
Browse files Browse the repository at this point in the history
  • Loading branch information
kabaros committed Nov 5, 2024
1 parent 7abb26f commit f2019b7
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 46 deletions.
32 changes: 16 additions & 16 deletions examples/cra/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1054,32 +1054,32 @@
integrity sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==

"@dhis2/app-runtime@file:../../runtime":
version "3.10.0-alpha.2"
version "3.10.4-alpha.1"
dependencies:
"@dhis2/app-service-alerts" "3.10.0-alpha.2"
"@dhis2/app-service-config" "3.10.0-alpha.2"
"@dhis2/app-service-data" "3.10.0-alpha.2"
"@dhis2/app-service-offline" "3.10.0-alpha.2"
"@dhis2/app-service-plugin" "3.10.0-alpha.2"
"@dhis2/app-service-alerts" "3.10.4-alpha.1"
"@dhis2/app-service-config" "3.10.4-alpha.1"
"@dhis2/app-service-data" "3.10.4-alpha.1"
"@dhis2/app-service-offline" "3.10.4-alpha.1"
"@dhis2/app-service-plugin" "3.10.4-alpha.1"

"@dhis2/[email protected].0-alpha.2", "@dhis2/app-service-alerts@file:../../services/alerts":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/app-service-alerts@file:../../services/alerts":
version "3.10.4-alpha.1"

"@dhis2/[email protected].0-alpha.2", "@dhis2/app-service-config@file:../../services/config":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/app-service-config@file:../../services/config":
version "3.10.4-alpha.1"

"@dhis2/[email protected].0-alpha.2", "@dhis2/app-service-data@file:../../services/data":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/app-service-data@file:../../services/data":
version "3.10.4-alpha.1"
dependencies:
react-query "^3.13.11"

"@dhis2/[email protected].0-alpha.2", "@dhis2/app-service-offline@file:../../services/offline":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/app-service-offline@file:../../services/offline":
version "3.10.4-alpha.1"
dependencies:
lodash "^4.17.21"

"@dhis2/[email protected].0-alpha.2", "@dhis2/app-service-plugin@file:../../services/plugin":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/app-service-plugin@file:../../services/plugin":
version "3.10.4-alpha.1"
dependencies:
post-robot "^10.0.46"

Expand Down
32 changes: 16 additions & 16 deletions examples/query-playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1800,32 +1800,32 @@
"@dhis2/app-service-offline" "3.8.0"

"@dhis2/app-runtime@^2.2.2", "@dhis2/app-runtime@file:../../runtime":
version "3.10.0-alpha.2"
version "3.10.4-alpha.1"
dependencies:
"@dhis2/app-service-alerts" "3.10.0-alpha.2"
"@dhis2/app-service-config" "3.10.0-alpha.2"
"@dhis2/app-service-data" "3.10.0-alpha.2"
"@dhis2/app-service-offline" "3.10.0-alpha.2"
"@dhis2/app-service-plugin" "3.10.0-alpha.2"
"@dhis2/app-service-alerts" "3.10.4-alpha.1"
"@dhis2/app-service-config" "3.10.4-alpha.1"
"@dhis2/app-service-data" "3.10.4-alpha.1"
"@dhis2/app-service-offline" "3.10.4-alpha.1"
"@dhis2/app-service-plugin" "3.10.4-alpha.1"

"@dhis2/[email protected].0-alpha.2", "@dhis2/[email protected]", "@dhis2/app-service-alerts@file:../../services/alerts":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/[email protected]", "@dhis2/app-service-alerts@file:../../services/alerts":
version "3.10.4-alpha.1"

"@dhis2/[email protected].0-alpha.2", "@dhis2/[email protected]", "@dhis2/app-service-config@file:../../services/config":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/[email protected]", "@dhis2/app-service-config@file:../../services/config":
version "3.10.4-alpha.1"

"@dhis2/[email protected].0-alpha.2", "@dhis2/[email protected]", "@dhis2/app-service-data@file:../../services/data":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/[email protected]", "@dhis2/app-service-data@file:../../services/data":
version "3.10.4-alpha.1"
dependencies:
react-query "^3.13.11"

"@dhis2/[email protected].0-alpha.2", "@dhis2/[email protected]", "@dhis2/app-service-offline@file:../../services/offline":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/[email protected]", "@dhis2/app-service-offline@file:../../services/offline":
version "3.10.4-alpha.1"
dependencies:
lodash "^4.17.21"

"@dhis2/[email protected].0-alpha.2", "@dhis2/app-service-plugin@file:../../services/plugin":
version "3.10.0-alpha.2"
"@dhis2/[email protected].4-alpha.1", "@dhis2/app-service-plugin@file:../../services/plugin":
version "3.10.4-alpha.1"
dependencies:
post-robot "^10.0.46"

Expand Down
2 changes: 1 addition & 1 deletion services/alerts/src/useAlert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useAlert = (
const alertRef = useRef(<Alert | null>null)

const show = useCallback(
(props?) => {
(props?: any) => {
const resolvedMessage = String(
typeof message === 'function' ? message(props) : message
)
Expand Down
2 changes: 1 addition & 1 deletion services/config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type Version = {
tag?: string
}

export type DateInput = string | Date | number | null
export type DateInput = string | Date | number | null | undefined

interface SystemInfo {
version: string
Expand Down
4 changes: 2 additions & 2 deletions services/config/src/useTimeZoneConversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const useTimeZoneConversion = (): {
)

const fromServerDate = useCallback(
(date) => {
(date: DateInput) => {
const jsServerDate = date ? new Date(date) : new Date(Date.now())
const offset = shouldCalculateOffset
? calculateOffset(jsServerDate, serverTimezone)
Expand All @@ -146,7 +146,7 @@ export const useTimeZoneConversion = (): {
)

const fromClientDate = useCallback(
(date) => {
(date: DateInput) => {
const jsClientDate = date ? new Date(date) : new Date(Date.now())
const offset = shouldCalculateOffset
? calculateOffset(jsClientDate, serverTimezone)
Expand Down
4 changes: 2 additions & 2 deletions services/data/src/react/hooks/useDataMutation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback } from 'react'
import { QueryOptions, Mutation } from '../../engine'
import { QueryOptions, Mutation, QueryExecuteOptions } from '../../engine'
import { MutationRenderInput } from '../../types'
import { useDataEngine } from './useDataEngine'
import { useQueryExecutor } from './useQueryExecutor'
Expand All @@ -16,7 +16,7 @@ export const useDataMutation = (
name: 'mutation',
})
const execute = useCallback(
(options) => engine.mutate(theMutation, options),
(options: QueryExecuteOptions) => engine.mutate(theMutation, options),
[engine, theMutation]
)
const {
Expand Down
13 changes: 7 additions & 6 deletions services/data/src/react/hooks/useDataQuery.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useState, useRef, useCallback, useDebugValue } from 'react'
import { useQuery, setLogger } from 'react-query'
import type {
Query,
QueryOptions,
QueryResult,
QueryVariables,
import {
JsonMap,
type Query,
type QueryOptions,
type QueryResult,
type QueryVariables,
} from '../../engine'
import type { FetchError } from '../../engine/types/FetchError'
import type { QueryRenderInput, QueryRefetchFunction } from '../../types'
Expand Down Expand Up @@ -146,7 +147,7 @@ export const useDataQuery = <TQueryResult = QueryResult>(
queryState.current.enabled = true

// This promise does not currently reject on errors
const refetchPromise = new Promise((resolve) => {
const refetchPromise = new Promise<TQueryResult>((resolve) => {
queryState.current.refetchCallback = (data) => {
resolve(data)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const Dhis2ConnectionStatusProvider = ({
* the lastConnected value in localStorage
*/
const updateConnectedState = useCallback(
(newIsConnected) => {
(newIsConnected: boolean | null) => {
// use 'set' with a function as param to get latest isConnected
// without needing it as a dependency for useCallback
setIsConnected((prevIsConnected) => {
Expand Down Expand Up @@ -125,7 +125,7 @@ export const Dhis2ConnectionStatusProvider = ({

/** Called when SW reports updates from incidental network traffic */
const onUpdate = useCallback(
({ isConnected: newIsConnected }) => {
({ isConnected: newIsConnected }: { isConnected: any }) => {
devDebugLog('[D2CS] handling update from sw')

// Snooze ping timer to reduce pings since we know state from SW
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
//TODO: This should move to app-platform for standardized typescript library builds
"compilerOptions": {
"skipLibCheck": true,
// Target latest version of ECMAScript.
"target": "esnext",
"declaration": true,
Expand Down

0 comments on commit f2019b7

Please sign in to comment.