From a3b922796d41702eb1db5d50ef742f2f29b98da4 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:12:49 +1000 Subject: [PATCH] chore: better type vs value import separation --- .../src/components/ErrorMessage.tsx | 2 +- .../react-native/src/components/ListItem.tsx | 4 +-- .../src/components/LoadingIndicator.tsx | 2 +- .../react-native/src/hooks/useAppState.ts | 3 +- .../src/navigation/MoviesStack.tsx | 2 +- .../react-native/src/navigation/types.ts | 2 +- .../src/screens/MovieDetailsScreen.tsx | 12 ++++---- .../src/screens/MoviesListScreen.tsx | 8 +++--- .../react/react-router/src/routes/root.tsx | 15 +++++----- .../playground/src/routes/AddTodo.svelte | 10 ++----- .../playground/src/routes/EditTodo.svelte | 2 +- .../playground/src/routes/TodosList.svelte | 2 +- .../etc/angular-query-experimental.api.md | 4 +-- .../util/lazy-init/lazy-init.test.ts | 2 +- .../lazy-signal-initializer.test.ts | 10 ++----- .../src/inject-mutation-state.ts | 15 +++++----- .../create-injection-token.ts | 28 +++++++++---------- .../lazy-signal-initializer.ts | 9 ++---- .../react-query/src/useSuspenseQueries.ts | 14 +++++----- packages/svelte-query/src/useHydrate.ts | 7 ++--- packages/svelte-query/src/useIsFetching.ts | 7 ++--- packages/svelte-query/src/useIsMutating.ts | 7 ++--- 22 files changed, 69 insertions(+), 98 deletions(-) diff --git a/examples/react/react-native/src/components/ErrorMessage.tsx b/examples/react/react-native/src/components/ErrorMessage.tsx index dd56c6649f..ef02fcef20 100644 --- a/examples/react/react-native/src/components/ErrorMessage.tsx +++ b/examples/react/react-native/src/components/ErrorMessage.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { Text, View, StyleSheet } from 'react-native' +import { StyleSheet, Text, View } from 'react-native' type Props = { message: string diff --git a/examples/react/react-native/src/components/ListItem.tsx b/examples/react/react-native/src/components/ListItem.tsx index 4544f3937c..bb9909ac6e 100644 --- a/examples/react/react-native/src/components/ListItem.tsx +++ b/examples/react/react-native/src/components/ListItem.tsx @@ -1,7 +1,7 @@ import * as React from 'react' -import { View, StyleSheet } from 'react-native' +import { StyleSheet, View } from 'react-native' import { Paragraph, TouchableRipple } from 'react-native-paper' -import { MovieDetails } from '../lib/api' +import type { MovieDetails } from '../lib/api' type Props = { item: MovieDetails diff --git a/examples/react/react-native/src/components/LoadingIndicator.tsx b/examples/react/react-native/src/components/LoadingIndicator.tsx index 7bcdd99253..5d07fdf64d 100644 --- a/examples/react/react-native/src/components/LoadingIndicator.tsx +++ b/examples/react/react-native/src/components/LoadingIndicator.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { ActivityIndicator, View, StyleSheet } from 'react-native' +import { ActivityIndicator, StyleSheet, View } from 'react-native' export function LoadingIndicator() { return ( diff --git a/examples/react/react-native/src/hooks/useAppState.ts b/examples/react/react-native/src/hooks/useAppState.ts index d0e1c2be07..44880eb8ac 100644 --- a/examples/react/react-native/src/hooks/useAppState.ts +++ b/examples/react/react-native/src/hooks/useAppState.ts @@ -1,5 +1,6 @@ import { useEffect } from 'react' -import { AppState, AppStateStatus } from 'react-native' +import { AppState } from 'react-native' +import type { AppStateStatus } from 'react-native' export function useAppState(onChange: (status: AppStateStatus) => void) { useEffect(() => { diff --git a/examples/react/react-native/src/navigation/MoviesStack.tsx b/examples/react/react-native/src/navigation/MoviesStack.tsx index 364126feb9..514fbc490e 100644 --- a/examples/react/react-native/src/navigation/MoviesStack.tsx +++ b/examples/react/react-native/src/navigation/MoviesStack.tsx @@ -3,7 +3,7 @@ import { createStackNavigator } from '@react-navigation/stack' import { MoviesListScreen } from '../screens/MoviesListScreen' import { MovieDetailsScreen } from '../screens/MovieDetailsScreen' -import { MoviesStackNavigator } from './types' +import type { MoviesStackNavigator } from './types' const Stack = createStackNavigator() diff --git a/examples/react/react-native/src/navigation/types.ts b/examples/react/react-native/src/navigation/types.ts index 2967bf0d5c..a54c309c94 100644 --- a/examples/react/react-native/src/navigation/types.ts +++ b/examples/react/react-native/src/navigation/types.ts @@ -1,4 +1,4 @@ -import { Movie } from '../lib/api' +import type { Movie } from '../lib/api' export type MoviesStackNavigator = { MoviesList: undefined diff --git a/examples/react/react-native/src/screens/MovieDetailsScreen.tsx b/examples/react/react-native/src/screens/MovieDetailsScreen.tsx index 643968fb56..62cc0288e7 100644 --- a/examples/react/react-native/src/screens/MovieDetailsScreen.tsx +++ b/examples/react/react-native/src/screens/MovieDetailsScreen.tsx @@ -1,15 +1,15 @@ import * as React from 'react' -import { View, RefreshControl, StyleSheet, ScrollView } from 'react-native' -import { Title, Paragraph } from 'react-native-paper' -import { StackNavigationProp } from '@react-navigation/stack' -import { RouteProp } from '@react-navigation/native' +import { RefreshControl, ScrollView, StyleSheet, View } from 'react-native' +import { Paragraph, Title } from 'react-native-paper' import { useQuery } from '@tanstack/react-query' - import { LoadingIndicator } from '../components/LoadingIndicator' import { ErrorMessage } from '../components/ErrorMessage' import { useRefreshByUser } from '../hooks/useRefreshByUser' -import { fetchMovie, MovieDetails } from '../lib/api' +import { fetchMovie } from '../lib/api' +import type { MovieDetails } from '../lib/api' import type { MoviesStackNavigator } from '../navigation/types' +import type { StackNavigationProp } from '@react-navigation/stack' +import type { RouteProp } from '@react-navigation/native' type MoviesDetailsScreenNavigationProp = StackNavigationProp< MoviesStackNavigator, diff --git a/examples/react/react-native/src/screens/MoviesListScreen.tsx b/examples/react/react-native/src/screens/MoviesListScreen.tsx index ad34c776f6..f5035e928c 100644 --- a/examples/react/react-native/src/screens/MoviesListScreen.tsx +++ b/examples/react/react-native/src/screens/MoviesListScreen.tsx @@ -1,16 +1,16 @@ import * as React from 'react' import { FlatList, RefreshControl } from 'react-native' import { useQuery } from '@tanstack/react-query' - -import { StackNavigationProp } from '@react-navigation/stack' import { LoadingIndicator } from '../components/LoadingIndicator' import { ErrorMessage } from '../components/ErrorMessage' import { Divider } from '../components/Divider' import { ListItem } from '../components/ListItem' import { useRefreshByUser } from '../hooks/useRefreshByUser' import { useRefreshOnFocus } from '../hooks/useRefreshOnFocus' -import { fetchMovies, Movie, MovieDetails } from '../lib/api' -import { MoviesStackNavigator } from '../navigation/types' +import { fetchMovies } from '../lib/api' +import type { Movie, MovieDetails } from '../lib/api' +import type { MoviesStackNavigator } from '../navigation/types' +import type { StackNavigationProp } from '@react-navigation/stack' type MoviesListScreenNavigationProp = StackNavigationProp< MoviesStackNavigator, diff --git a/examples/react/react-router/src/routes/root.tsx b/examples/react/react-router/src/routes/root.tsx index 661f082df0..4f2165cbe9 100644 --- a/examples/react/react-router/src/routes/root.tsx +++ b/examples/react/react-router/src/routes/root.tsx @@ -1,21 +1,20 @@ import { - Outlet, - useLoaderData, Link, NavLink, + Outlet, + useLoaderData, useNavigation, useSubmit, - LoaderFunctionArgs, } from 'react-router-dom' import { useDebounce } from 'rooks' - -import { getContacts } from '../contacts' import { - useSuspenseQuery, - useIsFetching, - type QueryClient, queryOptions, + useIsFetching, + useSuspenseQuery, } from '@tanstack/react-query' +import { getContacts } from '../contacts' +import type { QueryClient } from '@tanstack/react-query' +import type { LoaderFunctionArgs } from 'react-router-dom' const contactListQuery = (q?: string) => queryOptions({ diff --git a/examples/svelte/playground/src/routes/AddTodo.svelte b/examples/svelte/playground/src/routes/AddTodo.svelte index 97015c4e29..5fe8fc4dcd 100644 --- a/examples/svelte/playground/src/routes/AddTodo.svelte +++ b/examples/svelte/playground/src/routes/AddTodo.svelte @@ -1,13 +1,7 @@