Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"@rbxts/types": "^1.0.747",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-roblox-ts": "^0.0.36",
"eslint": "^8.56.0",
"prettier": "^3.2.4",
"roblox-ts": "^2.2.0",
"typescript": "^5.3.3"
"roblox-ts": "3.0.0-dev-d48bd20",
"typescript": "^5.7.3"
},
"dependencies": {
"@rbxts/object-utils": "^1.0.4",
"@rbxts/react-roblox": "^0.2.0",
"@rbxts/roact": "npm:@rbxts/react-ts@latest"
"@rbxts/react": "^17.2.3",
"@rbxts/react-roblox": "^17.2.3"
}
}
2 changes: 1 addition & 1 deletion src/react.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useDebugValue } from "@rbxts/roact";
// import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'
// This doesn't work in ESM, because use-sync-external-store only exposes CJS.
// See: https://github.com/pmndrs/valtio/issues/452
Expand All @@ -7,6 +6,7 @@ import { createStore } from "./vanilla";
import type { Mutate, StateCreator, StoreApi, StoreMutatorIdentifier } from "./vanilla";
import { useSyncExternalStoreWithSelector } from "./useSyncExternalStoreWithSelector";
import Object from "@rbxts/object-utils";
import { useDebugValue } from "@rbxts/react";

type ExtractState<S> = S extends { getState: () => infer T } ? T : never;

Expand Down
2 changes: 1 addition & 1 deletion src/useSyncExternalStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, useLayoutEffect, useDebugValue } from "@rbxts/roact";
import { useState, useEffect, useLayoutEffect, useDebugValue } from "@rbxts/react";
import { is } from "./object";

interface Snapshot<T> {
Expand Down
2 changes: 1 addition & 1 deletion src/useSyncExternalStoreWithSelector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useEffect, useMemo, useDebugValue } from "@rbxts/roact";
import { useRef, useEffect, useMemo, useDebugValue } from "@rbxts/react";
import { useSyncExternalStore } from "./useSyncExternalStore";
import { is } from "./object";

Expand Down
10 changes: 5 additions & 5 deletions src/vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ type Get<T, K, F> = K extends keyof T ? T[K] : F;
export type Mutate<S, Ms> = number extends Ms["length" & keyof Ms]
? S
: Ms extends []
? S
: Ms extends [[infer Mi, infer Ma], ...infer Mrs]
? Mutate<StoreMutators<S, Ma>[Mi & StoreMutatorIdentifier], Mrs>
: never;
? S
: Ms extends [[infer Mi, infer Ma], ...infer Mrs]
? Mutate<StoreMutators<S, Ma>[Mi & StoreMutatorIdentifier], Mrs>
: never;

export type StateCreator<
T,
Expand Down Expand Up @@ -67,7 +67,7 @@ const createStoreImpl: CreateStoreImpl = (createState) => {
if (!is(nextState, state)) {
const previousState = state;
state =
replace ?? !typeIs(nextState, "table") ? (nextState as TState) : Object.assign({}, state, nextState);
(replace ?? !typeIs(nextState, "table")) ? (nextState as TState) : Object.assign({}, state, nextState);

for (const listener of listeners) listener(state, previousState);
}
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"jsx": "react",
"jsxFactory": "Roact.createElement",
"jsxFragmentFactory": "Roact.Fragment",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"module": "commonjs",
"moduleResolution": "Node",
"noLib": true,
Expand Down
685 changes: 278 additions & 407 deletions yarn.lock

Large diffs are not rendered by default.