Skip to content

Commit

Permalink
satisfy typechecker
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffomatic committed Jun 22, 2023
1 parent 77db61a commit df0770f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/lodash/internal/nodeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const freeModule = freeExports && typeof module === 'object' && module !== null
const moduleExports = freeModule && freeModule.exports === freeExports

/** Detect free variable `process` from Node.js. */
const freeProcess = moduleExports && freeGlobal.process
const freeProcess = moduleExports && typeof freeGlobal === 'object' && freeGlobal.process

/** Used to access faster Node.js helpers. */
const nodeTypes = ((() => {
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/preact/signals-core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,4 +660,4 @@ function effect(compute: () => unknown): () => void {
return effect._dispose.bind(effect);
}

export { signal, computed, effect, batch, Signal, ReadonlySignal };
export { signal, computed, effect, batch, Signal, type ReadonlySignal };
46 changes: 23 additions & 23 deletions 3rdparty/preact/signals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@ const HAS_PENDING_UPDATE = 1 << 0;
const HAS_HOOK_STATE = 1 << 1;
const HAS_COMPUTEDS = 1 << 2;

const enum OptionsTypes {
HOOK = "_hook",
DIFF = "_diff",
DIFFED = "diffed",
RENDER = "_render",
CATCH_ERROR = "_catchError",
UNMOUNT = "unmount",
}

interface OptionsType {
[OptionsTypes.HOOK](component: Component, index: number, type: number): void;
[OptionsTypes.DIFF](vnode: VNode): void;
[OptionsTypes.DIFFED](vnode: VNode): void;
[OptionsTypes.RENDER](vnode: VNode): void;
[OptionsTypes.CATCH_ERROR](error: any, vnode: VNode, oldVNode: VNode): void;
[OptionsTypes.UNMOUNT](vnode: VNode): void;
}

type HookFn<T extends keyof OptionsType> = (
old: OptionsType[T],
...a: Parameters<OptionsType[T]>
) => ReturnType<OptionsType[T]>;

// Install a Preact options hook
function hook<T extends OptionsTypes>(hookName: T, hookFn: HookFn<T>) {
// @ts-ignore-next-line private options hooks usage
Expand Down Expand Up @@ -418,26 +441,3 @@ export function update<T extends SignalOrReactive>(
}
}
*/

const enum OptionsTypes {
HOOK = "_hook",
DIFF = "_diff",
DIFFED = "diffed",
RENDER = "_render",
CATCH_ERROR = "_catchError",
UNMOUNT = "unmount",
}

interface OptionsType {
[OptionsTypes.HOOK](component: Component, index: number, type: number): void;
[OptionsTypes.DIFF](vnode: VNode): void;
[OptionsTypes.DIFFED](vnode: VNode): void;
[OptionsTypes.RENDER](vnode: VNode): void;
[OptionsTypes.CATCH_ERROR](error: any, vnode: VNode, oldVNode: VNode): void;
[OptionsTypes.UNMOUNT](vnode: VNode): void;
}

type HookFn<T extends keyof OptionsType> = (
old: OptionsType[T],
...a: Parameters<OptionsType[T]>
) => ReturnType<OptionsType[T]>;
4 changes: 2 additions & 2 deletions onejs/comps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { SwitchProps, Switch, ToggleProps, Toggle, DiamondToggle } from "./Toggle"
export { ListboxProps, Listbox, SelectProps, Select } from "./Select"
export { type SwitchProps, Switch, type ToggleProps, Toggle, DiamondToggle } from "./Toggle"
export { type ListboxProps, Listbox, type SelectProps, Select } from "./Select"

0 comments on commit df0770f

Please sign in to comment.