Skip to content

Commit

Permalink
chore(3877): fix readonly type conflicts with Valtio
Browse files Browse the repository at this point in the history
  • Loading branch information
junminahn committed Sep 27, 2024
1 parent fbedcc1 commit fcb94dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
15 changes: 6 additions & 9 deletions app/components/billing/PublicCloudBillingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ export default function PublicCloudBillingInfo({
product,
className,
}: {
product: Omit<
Product & {
_permissions?: {
signMou: boolean;
reviewMou: boolean;
};
},
'providerSelectionReasons' | 'providerSelectionReasonsNote'
>;
product: Product & {
_permissions?: {
signMou: boolean;
reviewMou: boolean;
};
};
className?: string;
}) {
const { data: session } = useSession();
Expand Down
2 changes: 1 addition & 1 deletion app/components/billing/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export type Product = Omit<
};
};
}>,
'updatedAt' | 'providerSelectionReasons' | 'providerSelectionReasonsNote'
'updatedAt'
>;
5 changes: 2 additions & 3 deletions app/helpers/valtio.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createContext, useContext, useRef } from 'react';
import { proxy, useSnapshot } from 'valtio';
import type { Snapshot } from 'valtio/vanilla';

export function createValtioContext<T extends object>(initialState: T) {
const StateContext = createContext<T>(initialState);
Expand All @@ -24,7 +23,7 @@ export function createGlobalValtio<T extends object>(initialState: T) {

const useValtioState = function useValtioState() {
const snapshot = useSnapshot(state);
return [state, snapshot] as [T, Snapshot<T>];
return [state, snapshot];
};

return { state, useValtioState };
Expand All @@ -33,5 +32,5 @@ export function createGlobalValtio<T extends object>(initialState: T) {
export function useValtio<T extends object>(data: T) {
const state = useRef(proxy<T>(data)).current;
const snapshot = useSnapshot(state);
return [state, snapshot] as [T, Snapshot<T>];
return [state, snapshot];
}

0 comments on commit fcb94dc

Please sign in to comment.