From e0e823a5f1daa03ab014a9868708ffb762f9bc53 Mon Sep 17 00:00:00 2001 From: Damian Tarnawski Date: Mon, 16 Dec 2024 19:21:02 +0100 Subject: [PATCH 1/2] Update typescript to 5.7 --- package.json | 2 +- packages/solid/src/index.ts | 8 +-- packages/solid/src/reactive/array.ts | 7 ++- packages/solid/src/reactive/signal.ts | 55 ++++++++++--------- packages/solid/src/render/component.ts | 9 +-- packages/solid/src/render/flow.ts | 26 ++++----- packages/solid/src/server/rendering.ts | 1 - packages/solid/store/src/index.ts | 4 +- packages/solid/store/src/mutable.ts | 7 ++- packages/solid/store/src/store.ts | 13 +++-- packages/solid/test/resource.spec.ts | 32 +++++------ packages/solid/web/src/index.ts | 2 +- packages/solid/web/test/dynamic.spec.tsx | 4 +- .../solid/web/test/errorboundary.spec.tsx | 2 +- packages/solid/web/test/for.spec.tsx | 12 ++-- packages/solid/web/test/index.spec.tsx | 12 ++-- packages/solid/web/test/portal.spec.tsx | 6 +- packages/solid/web/test/show.spec.tsx | 18 +++--- packages/solid/web/test/switch.spec.tsx | 14 ++--- pnpm-lock.yaml | 28 +++++----- 20 files changed, 131 insertions(+), 131 deletions(-) diff --git a/package.json b/package.json index fa7369c62..bd747de53 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "symlink-dir": "^5.0.1", "tsconfig-replace-paths": "^0.0.11", "turbo": "^1.3.1", - "typescript": "~5.5.2", + "typescript": "~5.7.2", "vite-plugin-solid": "^2.6.1", "vitest": "^2.1.2" }, diff --git a/packages/solid/src/index.ts b/packages/solid/src/index.ts index 54cb9b71a..933269674 100644 --- a/packages/solid/src/index.ts +++ b/packages/solid/src/index.ts @@ -72,17 +72,15 @@ type JSXElement = JSX.Element; export type { JSXElement, JSX }; // dev -import { registerGraph, writeSignal, DevHooks } from "./reactive/signal.js"; -export const DEV = "_SOLID_DEV_" - ? ({ hooks: DevHooks, writeSignal, registerGraph } as const) - : undefined; +import { registerGraph, writeSignal, DevHooks, IS_DEV } from "./reactive/signal.js"; +export const DEV = IS_DEV ? ({ hooks: DevHooks, writeSignal, registerGraph } as const) : undefined; // handle multiple instance check declare global { var Solid$$: boolean; } -if ("_SOLID_DEV_" && globalThis) { +if (IS_DEV && globalThis) { if (!globalThis.Solid$$) globalThis.Solid$$ = true; else console.warn( diff --git a/packages/solid/src/reactive/array.ts b/packages/solid/src/reactive/array.ts index 1327315a1..cc8906f5d 100644 --- a/packages/solid/src/reactive/array.ts +++ b/packages/solid/src/reactive/array.ts @@ -5,7 +5,8 @@ import { createSignal, Accessor, Setter, - $TRACK + $TRACK, + IS_DEV } from "./signal.js"; const FALLBACK = Symbol("fallback"); @@ -166,7 +167,7 @@ export function mapArray( function mapper(disposer: () => void) { disposers[j] = disposer; if (indexes) { - const [s, set] = "_SOLID_DEV_" ? createSignal(j, { name: "index" }) : createSignal(j); + const [s, set] = IS_DEV ? createSignal(j, { name: "index" }) : createSignal(j); indexes[j] = set; return mapFn(newItems[j], s); } @@ -243,7 +244,7 @@ export function indexArray( }); function mapper(disposer: () => void) { disposers[i] = disposer; - const [s, set] = "_SOLID_DEV_" + const [s, set] = IS_DEV ? createSignal(newItems[i], { name: "value" }) : createSignal(newItems[i]); signals[i] = set; diff --git a/packages/solid/src/reactive/signal.ts b/packages/solid/src/reactive/signal.ts index fd1ab94d2..d653c60fc 100644 --- a/packages/solid/src/reactive/signal.ts +++ b/packages/solid/src/reactive/signal.ts @@ -28,6 +28,9 @@ import { setHydrateContext, sharedConfig } from "../render/hydration.js"; import type { JSX } from "../jsx.js"; import type { FlowComponent, FlowProps } from "../render/index.js"; +// replaced during build +export const IS_DEV = "_SOLID_DEV_" as string | boolean; + export const equalFn = (a: T, b: T) => a === b; export const $PROXY = Symbol("solid-proxy"); export const SUPPORTS_PROXY = typeof Proxy === "function"; @@ -145,7 +148,7 @@ export function createRoot(fn: RootFunction, detachedOwner?: typeof Owner) unowned = fn.length === 0, current = detachedOwner === undefined ? owner : detachedOwner, root: Owner = unowned - ? "_SOLID_DEV_" + ? IS_DEV ? { owned: null, cleanups: null, context: null, owner: null } : UNOWNED : { @@ -155,7 +158,7 @@ export function createRoot(fn: RootFunction, detachedOwner?: typeof Owner) owner: current }, updateFn = unowned - ? "_SOLID_DEV_" + ? IS_DEV ? () => fn(() => { throw new Error("Dispose method must be an explicit argument to createRoot function"); @@ -163,7 +166,7 @@ export function createRoot(fn: RootFunction, detachedOwner?: typeof Owner) : fn : () => fn(() => untrack(() => cleanNode(root))); - if ("_SOLID_DEV_") DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root); + if (IS_DEV) DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root); Owner = root; Listener = null; @@ -231,7 +234,7 @@ export function createSignal( comparator: options.equals || undefined }; - if ("_SOLID_DEV_") { + if (IS_DEV) { if (options.name) s.name = options.name; if (DevHooks.afterCreateSignal) DevHooks.afterCreateSignal(s); if (!options.internal) registerGraph(s); @@ -288,7 +291,7 @@ export function createComputed( value?: Init, options?: EffectOptions ): void { - const c = createComputation(fn, value!, true, STALE, "_SOLID_DEV_" ? options : undefined); + const c = createComputation(fn, value!, true, STALE, IS_DEV ? options : undefined); if (Scheduler && Transition && Transition.running) Updates!.push(c); else updateComputation(c); } @@ -319,7 +322,7 @@ export function createRenderEffect( value?: Init, options?: EffectOptions ): void { - const c = createComputation(fn, value!, false, STALE, "_SOLID_DEV_" ? options : undefined); + const c = createComputation(fn, value!, false, STALE, IS_DEV ? options : undefined); if (Scheduler && Transition && Transition.running) Updates!.push(c); else updateComputation(c); } @@ -351,7 +354,7 @@ export function createEffect( options?: EffectOptions & { render?: boolean } ): void { runEffects = runUserEffects; - const c = createComputation(fn, value!, false, STALE, "_SOLID_DEV_" ? options : undefined), + const c = createComputation(fn, value!, false, STALE, IS_DEV ? options : undefined), s = SuspenseContext && useContext(SuspenseContext); if (s) c.suspense = s; if (!options || !options.render) c.user = true; @@ -381,7 +384,7 @@ export function createReaction(onInvalidate: () => void, options?: EffectOptions undefined, false, 0, - "_SOLID_DEV_" ? options : undefined + IS_DEV ? options : undefined ), s = SuspenseContext && useContext(SuspenseContext); if (s) c.suspense = s; @@ -439,7 +442,7 @@ export function createMemo( value!, true, 0, - "_SOLID_DEV_" ? options : undefined + IS_DEV ? options : undefined ) as Partial>; c.observers = null; @@ -591,7 +594,7 @@ export function createResource( let source: ResourceSource; let fetcher: ResourceFetcher; let options: ResourceOptions; - + if (typeof pFetcher === "function") { source = pSource as ResourceSource; fetcher = pFetcher as ResourceFetcher; @@ -829,7 +832,7 @@ export function createSelector( undefined, true, STALE, - "_SOLID_DEV_" ? options : undefined + IS_DEV ? options : undefined ) as Memo; updateComputation(node); return (key: U) => { @@ -839,8 +842,8 @@ export function createSelector( if ((l = subs.get(key))) l.add(listener); else subs.set(key, (l = new Set([listener]))); onCleanup(() => { - l!.delete(listener!); - !l!.size && subs.delete(key); + l.delete(listener); + !l.size && subs.delete(key); }); } return fn( @@ -982,8 +985,7 @@ export function onMount(fn: () => void) { */ export function onCleanup any>(fn: T): T { if (Owner === null) - "_SOLID_DEV_" && - console.warn("cleanups created outside a `createRoot` or `render` will never be run"); + IS_DEV && console.warn("cleanups created outside a `createRoot` or `render` will never be run"); else if (Owner.cleanups === null) Owner.cleanups = [fn]; else Owner.cleanups.push(fn); return fn; @@ -1207,7 +1209,7 @@ export type ChildrenReturn = Accessor & { toArray: () => Resol */ export function children(fn: Accessor): ChildrenReturn { const children = createMemo(fn); - const memo = "_SOLID_DEV_" + const memo = IS_DEV ? createMemo(() => resolveChildren(children()), undefined, { name: "children" }) : createMemo(() => resolveChildren(children())); (memo as ChildrenReturn).toArray = () => { @@ -1329,7 +1331,7 @@ export function writeSignal(node: SignalState | Memo, value: any, isCo } if (Updates!.length > 10e5) { Updates = []; - if ("_SOLID_DEV_") throw new Error("Potential Infinite Loop Detected."); + if (IS_DEV) throw new Error("Potential Infinite Loop Detected."); throw new Error(); } }, false); @@ -1426,7 +1428,7 @@ function createComputation( } if (Owner === null) - "_SOLID_DEV_" && + IS_DEV && console.warn( "computations created outside a `createRoot` or `render` will never be disposed" ); @@ -1440,7 +1442,7 @@ function createComputation( } } - if ("_SOLID_DEV_" && options && options.name) c.name = options.name; + if (IS_DEV && options && options.name) c.name = options.name; if (ExternalSourceConfig && c.fn) { const [track, trigger] = createSignal(undefined, { equals: false }); @@ -1455,7 +1457,7 @@ function createComputation( }; } - if ("_SOLID_DEV_") DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c); + if (IS_DEV) DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c); return c; } @@ -1464,8 +1466,7 @@ function runTop(node: Computation) { const runningTransition = Transition && Transition.running; if ((runningTransition ? node.tState : node.state) === 0) return; if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node); - if (node.suspense && untrack(node.suspense.inFallback!)) - return node!.suspense.effects!.push(node!); + if (node.suspense && untrack(node.suspense.inFallback!)) return node.suspense.effects!.push(node); const ancestors = [node]; while ( (node = node.owner as Computation) && @@ -1557,8 +1558,8 @@ function completeUpdates(wait: boolean) { } const e = Effects!; Effects = null; - if (e!.length) runUpdates(() => runEffects(e), false); - else if ("_SOLID_DEV_") DevHooks.afterUpdate && DevHooks.afterUpdate(); + if (e.length) runUpdates(() => runEffects(e), false); + else if (IS_DEV) DevHooks.afterUpdate && DevHooks.afterUpdate(); if (res) res(); } @@ -1675,7 +1676,7 @@ function cleanNode(node: Owner) { } if (Transition && Transition.running) (node as Computation).tState = 0; else (node as Computation).state = 0; - "_SOLID_DEV_" && delete node.sourceMap; + IS_DEV && delete node.sourceMap; } function reset(node: Computation, top?: boolean) { @@ -1707,7 +1708,7 @@ function handleError(err: unknown, owner = Owner) { if (!fns) throw error; if (Effects) - Effects!.push({ + Effects.push({ fn() { runErrors(error, fns, owner); }, @@ -1759,7 +1760,7 @@ type TODO = any; export function onError(fn: (err: Error) => void): void { ERROR || (ERROR = Symbol("error")); if (Owner === null) - "_SOLID_DEV_" && + IS_DEV && console.warn("error handlers created outside a `createRoot` or `render` will never be run"); else if (Owner.context === null || !Owner.context[ERROR]) { // terrible de-opt diff --git a/packages/solid/src/render/component.ts b/packages/solid/src/render/component.ts index 83bc7a329..1a00005ae 100644 --- a/packages/solid/src/render/component.ts +++ b/packages/solid/src/render/component.ts @@ -7,7 +7,8 @@ import { $PROXY, SUPPORTS_PROXY, $DEVCOMP, - EffectFunction + EffectFunction, + IS_DEV } from "../reactive/signal.js"; import { sharedConfig, nextHydrateContext, setHydrateContext } from "./hydration.js"; import type { JSX } from "../jsx.js"; @@ -99,14 +100,14 @@ export function createComponent>( if (sharedConfig.context) { const c = sharedConfig.context; setHydrateContext(nextHydrateContext()); - const r = "_SOLID_DEV_" + const r = IS_DEV ? devComponent(Comp, props || ({} as T)) : untrack(() => Comp(props || ({} as T))); setHydrateContext(c); return r; } } - if ("_SOLID_DEV_") return devComponent(Comp, props || ({} as T)); + if (IS_DEV) return devComponent(Comp, props || ({} as T)); return untrack(() => Comp(props || ({} as T))); } @@ -376,7 +377,7 @@ export function lazy>( return createMemo(() => (Comp = comp()) ? untrack(() => { - if ("_SOLID_DEV_") Object.assign(Comp!, { [$DEVCOMP]: true }); + if (IS_DEV) Object.assign(Comp!, { [$DEVCOMP]: true }); if (!ctx || sharedConfig.done) return Comp!(props); const c = sharedConfig.context; setHydrateContext(ctx); diff --git a/packages/solid/src/render/flow.ts b/packages/solid/src/render/flow.ts index d48737b61..3ece3bc25 100644 --- a/packages/solid/src/render/flow.ts +++ b/packages/solid/src/render/flow.ts @@ -7,14 +7,15 @@ import { Accessor, Setter, onCleanup, - MemoOptions + MemoOptions, + IS_DEV } from "../reactive/signal.js"; import { mapArray, indexArray } from "../reactive/array.js"; import { sharedConfig } from "./hydration.js"; import type { JSX } from "../jsx.js"; const narrowedError = (name: string) => - "_SOLID_DEV_" + IS_DEV ? `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` : `Stale read from <${name}>.`; @@ -37,7 +38,7 @@ export function For(props: { children: (item: T[number], index: Accessor) => U; }) { const fallback = "fallback" in props && { fallback: () => props.fallback }; - return ("_SOLID_DEV_" + return (IS_DEV ? createMemo( mapArray(() => props.each, props.children, fallback || undefined), undefined, @@ -67,7 +68,7 @@ export function Index(props: { children: (item: Accessor, index: number) => U; }) { const fallback = "fallback" in props && { fallback: () => props.fallback }; - return ("_SOLID_DEV_" + return (IS_DEV ? createMemo( indexArray(() => props.each, props.children, fallback || undefined), undefined, @@ -108,7 +109,7 @@ export function Show(props: { const condition = createMemo( () => props.when, undefined, - "_SOLID_DEV_" + IS_DEV ? { equals: (a, b) => (keyed ? a === b : !a === !b), name: "condition" @@ -137,7 +138,7 @@ export function Show(props: { return props.fallback; }, undefined, - "_SOLID_DEV_" ? { name: "value" } : undefined + IS_DEV ? { name: "value" } : undefined ) as unknown as JSX.Element; } @@ -176,7 +177,7 @@ export function Switch(props: { fallback?: JSX.Element; children: JSX.Element }) return [-1]; }, undefined, - "_SOLID_DEV_" ? { equals, name: "eval conditions" } : { equals } + IS_DEV ? { equals, name: "eval conditions" } : { equals } ); return createMemo( () => { @@ -198,7 +199,7 @@ export function Switch(props: { fallback?: JSX.Element; children: JSX.Element }) : c; }, undefined, - "_SOLID_DEV_" ? { name: "value" } : undefined + IS_DEV ? { name: "value" } : undefined ) as unknown as JSX.Element; } @@ -259,10 +260,7 @@ export function ErrorBoundary(props: { let err; if (sharedConfig!.context && sharedConfig!.load) err = sharedConfig.load(sharedConfig.getContextId()); - const [errored, setErrored] = createSignal( - err, - "_SOLID_DEV_" ? { name: "errored" } : undefined - ); + const [errored, setErrored] = createSignal(err, IS_DEV ? { name: "errored" } : undefined); Errors || (Errors = new Set()); Errors.add(setErrored); onCleanup(() => Errors.delete(setErrored)); @@ -271,12 +269,12 @@ export function ErrorBoundary(props: { let e: any; if ((e = errored())) { const f = props.fallback; - if ("_SOLID_DEV_" && (typeof f !== "function" || f.length == 0)) console.error(e); + if (IS_DEV && (typeof f !== "function" || f.length == 0)) console.error(e); return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f; } return catchError(() => props.children, setErrored); }, undefined, - "_SOLID_DEV_" ? { name: "value" } : undefined + IS_DEV ? { name: "value" } : undefined ) as unknown as JSX.Element; } diff --git a/packages/solid/src/server/rendering.ts b/packages/solid/src/server/rendering.ts index e14cdf42e..e99b691b3 100644 --- a/packages/solid/src/server/rendering.ts +++ b/packages/solid/src/server/rendering.ts @@ -374,7 +374,6 @@ export function createResource( fetcher?: ResourceFetcher | ResourceOptions | ResourceOptions, options: ResourceOptions | ResourceOptions = {} ): ResourceReturn | ResourceReturn { - if (typeof fetcher !== "function") { source = true as ResourceSource; fetcher = source as ResourceFetcher; diff --git a/packages/solid/store/src/index.ts b/packages/solid/store/src/index.ts index 99a3ae076..47120ddb8 100644 --- a/packages/solid/store/src/index.ts +++ b/packages/solid/store/src/index.ts @@ -16,5 +16,5 @@ export * from "./mutable.js"; export * from "./modifiers.js"; // dev -import { $NODE, isWrappable, DevHooks } from "./store.js"; -export const DEV = "_SOLID_DEV_" ? ({ $NODE, isWrappable, hooks: DevHooks } as const) : undefined; +import { $NODE, isWrappable, DevHooks, IS_DEV } from "./store.js"; +export const DEV = IS_DEV ? ({ $NODE, isWrappable, hooks: DevHooks } as const) : undefined; diff --git a/packages/solid/store/src/mutable.ts b/packages/solid/store/src/mutable.ts index 03afb2e35..0929f6671 100644 --- a/packages/solid/store/src/mutable.ts +++ b/packages/solid/store/src/mutable.ts @@ -10,7 +10,8 @@ import { $HAS, StoreNode, setProperty, - ownKeys + ownKeys, + IS_DEV } from "./store.js"; function proxyDescriptor(target: StoreNode, property: PropertyKey) { @@ -133,13 +134,13 @@ function wrap(value: T): T { export function createMutable(state: T, options?: { name?: string }): T { const unwrappedStore = unwrap(state || {}); - if ("_SOLID_DEV_" && typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") + if (IS_DEV && typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error( `Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.` ); const wrappedStore = wrap(unwrappedStore); - if ("_SOLID_DEV_") DEV!.registerGraph({ value: unwrappedStore, name: options && options.name }); + if (IS_DEV) DEV!.registerGraph({ value: unwrappedStore, name: options && options.name }); return wrappedStore; } diff --git a/packages/solid/store/src/store.ts b/packages/solid/store/src/store.ts index 3402bae1a..9bbbf5132 100644 --- a/packages/solid/store/src/store.ts +++ b/packages/solid/store/src/store.ts @@ -1,5 +1,8 @@ import { getListener, batch, DEV, $PROXY, $TRACK, createSignal } from "solid-js"; +// replaced during build +export const IS_DEV = "_SOLID_DEV_" as string | boolean; + export const $RAW = Symbol("store-raw"), $NODE = Symbol("store-node"), $HAS = Symbol("store-has"), @@ -192,12 +195,12 @@ const proxyTraps: ProxyHandler = { }, set() { - if ("_SOLID_DEV_") console.warn("Cannot mutate a Store directly"); + if (IS_DEV) console.warn("Cannot mutate a Store directly"); return true; }, deleteProperty() { - if ("_SOLID_DEV_") console.warn("Cannot mutate a Store directly"); + if (IS_DEV) console.warn("Cannot mutate a Store directly"); return true; }, @@ -216,7 +219,7 @@ export function setProperty( const prev = state[property], len = state.length; - if ("_SOLID_DEV_") + if (IS_DEV) DevHooks.onStoreNodeUpdate && DevHooks.onStoreNodeUpdate(state, property, value, prev); if (value === undefined) { @@ -502,12 +505,12 @@ export function createStore( ): [get: Store, set: SetStoreFunction] { const unwrappedStore = unwrap((store || {}) as T); const isArray = Array.isArray(unwrappedStore); - if ("_SOLID_DEV_" && typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") + if (IS_DEV && typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error( `Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.` ); const wrappedStore = wrap(unwrappedStore); - if ("_SOLID_DEV_") DEV!.registerGraph({ value: unwrappedStore, name: options && options.name }); + if (IS_DEV) DEV!.registerGraph({ value: unwrappedStore, name: options && options.name }); function setStore(...args: any[]): void { batch(() => { isArray && args.length === 1 diff --git a/packages/solid/test/resource.spec.ts b/packages/solid/test/resource.spec.ts index 71f9f8d3d..df4d2cbbc 100644 --- a/packages/solid/test/resource.spec.ts +++ b/packages/solid/test/resource.spec.ts @@ -387,33 +387,31 @@ describe("using Resource with custom store", () => { }); describe("createResource can be wrapped", () => { - const fns: [name: string, function: typeof createResource][] = [ ["original createResource", createResource], // @ts-ignore ["createResource(...args)", (...args) => createResource(...args)], // @ts-ignore - ["createResource(a, b, c)", (a, b, c) => createResource(a, b, c)], - ] + ["createResource(a, b, c)", (a, b, c) => createResource(a, b, c)] + ]; for (const [name, fn] of fns) { - test(`only fetcher in ${name}`, () => { - const [[data], dispose] = createRoot(dispose => [fn(() => 123), dispose]) - expect(data()).toBe(123) - dispose() - }) - + const [[data], dispose] = createRoot(dispose => [fn(() => 123), dispose]); + expect(data()).toBe(123); + dispose(); + }); + test(`fetcher and source in ${name}`, () => { - const [source, setSource] = createSignal(1) + const [source, setSource] = createSignal(1); - const [[data], dispose] = createRoot(dispose => [fn(source, v => v), dispose]) - expect(data()).toBe(1) + const [[data], dispose] = createRoot(dispose => [fn(source, v => v), dispose]); + expect(data()).toBe(1); - setSource(2) - expect(data()).toBe(2) + setSource(2); + expect(data()).toBe(2); - dispose() - }) + dispose(); + }); } -}) +}); diff --git a/packages/solid/web/src/index.ts b/packages/solid/web/src/index.ts index 4d279d8aa..78e36b2d7 100644 --- a/packages/solid/web/src/index.ts +++ b/packages/solid/web/src/index.ts @@ -128,7 +128,7 @@ export function Dynamic(props: DynamicProps): JSX.E const component = cached(); switch (typeof component) { case "function": - if ("_DX_DEV_") Object.assign(component, { [$DEVCOMP]: true }); + if (isDev) Object.assign(component, { [$DEVCOMP]: true }); return untrack(() => component(others)); case "string": diff --git a/packages/solid/web/test/dynamic.spec.tsx b/packages/solid/web/test/dynamic.spec.tsx index 178d88e25..76d1fcc26 100644 --- a/packages/solid/web/test/dynamic.spec.tsx +++ b/packages/solid/web/test/dynamic.spec.tsx @@ -8,7 +8,7 @@ import { createStore } from "../../store/src/index.js"; import { Dynamic } from "../src/index.js"; describe("Testing Dynamic control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; interface ExampleProps { id: string; @@ -56,7 +56,7 @@ describe("Testing Dynamic control flow", () => { }); describe("Testing Dynamic with state spread", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; interface ExampleProps { id: string; diff --git a/packages/solid/web/test/errorboundary.spec.tsx b/packages/solid/web/test/errorboundary.spec.tsx index 20a8cd266..17cc19e69 100644 --- a/packages/solid/web/test/errorboundary.spec.tsx +++ b/packages/solid/web/test/errorboundary.spec.tsx @@ -7,7 +7,7 @@ import { createRoot, resetErrorBoundaries } from "../../src/index.js"; import { ErrorBoundary } from "../src/index.js"; describe("Testing ErrorBoundary control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const Component = () => { throw new Error("Failure"); diff --git a/packages/solid/web/test/for.spec.tsx b/packages/solid/web/test/for.spec.tsx index e3bab9310..1b536efa2 100644 --- a/packages/solid/web/test/for.spec.tsx +++ b/packages/solid/web/test/for.spec.tsx @@ -7,7 +7,7 @@ import { createRoot, createSignal } from "../../src/index.js"; import { insert, For } from "../src/index.js"; describe("Testing an only child each control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -173,7 +173,7 @@ describe("Testing an multi child each control flow", () => { }); describe("Testing an only child each control flow with fragment children", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -264,7 +264,7 @@ describe("Testing an only child each control flow with fragment children", () => }); describe("Testing an only child each control flow with array children", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -348,7 +348,7 @@ describe("Testing an only child each control flow with array children", () => { }); describe("Testing each control flow with fallback", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -378,7 +378,7 @@ describe("Testing each control flow with fallback", () => { }); describe("Testing each that maps to undefined", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -406,7 +406,7 @@ describe("Testing each that maps to undefined", () => { }); describe("Testing each with indexes", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", diff --git a/packages/solid/web/test/index.spec.tsx b/packages/solid/web/test/index.spec.tsx index e757bc170..1392477fa 100644 --- a/packages/solid/web/test/index.spec.tsx +++ b/packages/solid/web/test/index.spec.tsx @@ -7,7 +7,7 @@ import { createRoot, createSignal } from "../../src/index.js"; import { insert, Index } from "../src/index.js"; describe("Testing an only child each control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -173,7 +173,7 @@ describe("Testing an multi child each control flow", () => { }); describe("Testing an only child each control flow with fragment children", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -264,7 +264,7 @@ describe("Testing an only child each control flow with fragment children", () => }); describe("Testing an only child each control flow with array children", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -355,7 +355,7 @@ describe("Testing an only child each control flow with array children", () => { }); describe("Testing each control flow with fallback", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -385,7 +385,7 @@ describe("Testing each control flow with fallback", () => { }); describe("Testing each that maps to undefined", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", @@ -413,7 +413,7 @@ describe("Testing each that maps to undefined", () => { }); describe("Testing each with indexes", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const n1 = "a", n2 = "b", n3 = "c", diff --git a/packages/solid/web/test/portal.spec.tsx b/packages/solid/web/test/portal.spec.tsx index 413bec263..9cae05b1c 100644 --- a/packages/solid/web/test/portal.spec.tsx +++ b/packages/solid/web/test/portal.spec.tsx @@ -86,8 +86,8 @@ describe("Testing a Portal to the head", () => { describe("Testing a Portal with Synthetic Events", () => { let div = document.createElement("div"), disposer: () => void, - checkElem: HTMLDivElement, - testElem: HTMLDivElement, + checkElem!: HTMLDivElement, + testElem!: HTMLDivElement, clicked = false; const Component = () => ( @@ -119,7 +119,7 @@ describe("Testing a Portal with direct reactive children", () => { let div = document.createElement("div"), disposer: () => void, [count, setCount] = createSignal(0), - portalElem: HTMLDivElement; + portalElem!: HTMLDivElement; const Component = () => {count()}; test("Create portal control flow", () => { diff --git a/packages/solid/web/test/show.spec.tsx b/packages/solid/web/test/show.spec.tsx index c2f032b51..d5ca4c743 100644 --- a/packages/solid/web/test/show.spec.tsx +++ b/packages/solid/web/test/show.spec.tsx @@ -7,7 +7,7 @@ import { createRoot, createSignal } from "../../src/index.js"; import { Show } from "../src/index.js"; describe("Testing an only child show control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); const Component = () => (
@@ -37,7 +37,7 @@ describe("Testing an only child show control flow", () => { }); describe("Testing an only child show control flow with DOM children", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); const Component = () => (
@@ -70,7 +70,7 @@ describe("Testing an only child show control flow with DOM children", () => { }); describe("Testing nonkeyed show control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); let executed = 0; const Component = () => ( @@ -108,7 +108,7 @@ describe("Testing nonkeyed show control flow", () => { }); describe("Testing keyed show control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); let executed = 0; const Component = () => ( @@ -146,7 +146,7 @@ describe("Testing keyed show control flow", () => { }); describe("Testing nonkeyed function show control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); let executed = 0; const Component = () => ( @@ -188,7 +188,7 @@ describe("Testing nonkeyed function show control flow", () => { }); describe("Testing keyed function show control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); let executed = 0; const Component = () => ( @@ -230,7 +230,7 @@ describe("Testing keyed function show control flow", () => { }); describe("Testing an only child show control flow with keyed function", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [data, setData] = createSignal<{ count: number }>(); const Component = () => (
@@ -267,7 +267,7 @@ describe("Testing an only child show control flow with keyed function", () => { }); describe("Testing an only child show control flow with non-keyed function", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [data, setData] = createSignal<{ count: number }>(); const Component = () => (
@@ -304,7 +304,7 @@ describe("Testing an only child show control flow with non-keyed function", () = }); describe("Testing an only child show control flow with DOM children and fallback", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); const Component = () => (
diff --git a/packages/solid/web/test/switch.spec.tsx b/packages/solid/web/test/switch.spec.tsx index d0f55d377..71ef0aa88 100644 --- a/packages/solid/web/test/switch.spec.tsx +++ b/packages/solid/web/test/switch.spec.tsx @@ -8,7 +8,7 @@ import { createRoot, createSignal } from "../../src/index.js"; import { createStore } from "../../store/src/index.js"; describe("Testing a single match switch control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); const Component = () => (
@@ -38,7 +38,7 @@ describe("Testing a single match switch control flow", () => { }); describe("Testing an only child Switch control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [count, setCount] = createSignal(0); const Component = () => (
@@ -83,7 +83,7 @@ describe("Testing an only child Switch control flow", () => { }); describe("Testing keyed Switch control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [a, setA] = createSignal(0), [b, setB] = createSignal(0), [c, setC] = createSignal(0); @@ -127,7 +127,7 @@ describe("Testing keyed Switch control flow", () => { }); describe("Testing keyed function handler Switch control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [a, setA] = createSignal(0), [b, setB] = createSignal(0), [c, setC] = createSignal(0); @@ -171,7 +171,7 @@ describe("Testing keyed function handler Switch control flow", () => { }); describe("Testing non-keyed function handler Switch control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [a, setA] = createSignal(0), [b, setB] = createSignal(0), [c, setC] = createSignal(0); @@ -209,7 +209,7 @@ describe("Testing non-keyed function handler Switch control flow", () => { }); describe("Testing non-keyed function handler Switch control flow with dangling callback", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [a, setA] = createSignal(0), [b] = createSignal(2); let callback: () => void; @@ -251,7 +251,7 @@ describe("Testing non-keyed function handler Switch control flow with dangling c }); describe("Testing a For in a Switch control flow", () => { - let div: HTMLDivElement, disposer: () => void; + let div!: HTMLDivElement, disposer: () => void; const [state, setState] = createStore({ users: [ { firstName: "Jerry", certified: false }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd2f65cf7..1243d67cb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -105,11 +105,11 @@ importers: specifier: ^1.3.1 version: 1.13.4 typescript: - specifier: ~5.5.2 - version: 5.5.4 + specifier: ~5.7.2 + version: 5.7.2 vite-plugin-solid: specifier: ^2.6.1 - version: 2.10.2(solid-js@1.9.2)(vite@5.4.8(@types/node@22.7.5)) + version: 2.10.2(solid-js@1.9.3)(vite@5.4.8(@types/node@22.7.5)) vitest: specifier: ^2.1.2 version: 2.1.2(@types/node@22.7.5)(jsdom@25.0.1) @@ -2767,8 +2767,8 @@ packages: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} - solid-js@1.9.2: - resolution: {integrity: sha512-fe/K03nV+kMFJYhAOE8AIQHcGxB4rMIEoEyrulbtmf217NffbbwBqJnJI4ovt16e+kaIt0czE2WA7mP/pYN9yg==} + solid-js@1.9.3: + resolution: {integrity: sha512-5ba3taPoZGt9GY3YlsCB24kCg0Lv/rie/HTD4kG6h4daZZz7+yK02xn8Vx8dLYBc9i6Ps5JwAbEiqjmKaLB3Ag==} solid-refresh@0.6.3: resolution: {integrity: sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA==} @@ -3000,8 +3000,8 @@ packages: resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} engines: {node: '>= 0.4'} - typescript@5.5.4: - resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==} + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} hasBin: true @@ -6217,18 +6217,18 @@ snapshots: slash@3.0.0: {} - solid-js@1.9.2: + solid-js@1.9.3: dependencies: csstype: 3.1.3 seroval: 1.1.1 seroval-plugins: 1.1.1(seroval@1.1.1) - solid-refresh@0.6.3(solid-js@1.9.2): + solid-refresh@0.6.3(solid-js@1.9.3): dependencies: '@babel/generator': 7.25.7 '@babel/helper-module-imports': 7.25.7 '@babel/types': 7.25.7 - solid-js: 1.9.2 + solid-js: 1.9.3 transitivePeerDependencies: - supports-color @@ -6474,7 +6474,7 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - typescript@5.5.4: {} + typescript@5.7.2: {} unbox-primitive@1.0.2: dependencies: @@ -6548,14 +6548,14 @@ snapshots: - supports-color - terser - vite-plugin-solid@2.10.2(solid-js@1.9.2)(vite@5.4.8(@types/node@22.7.5)): + vite-plugin-solid@2.10.2(solid-js@1.9.3)(vite@5.4.8(@types/node@22.7.5)): dependencies: '@babel/core': 7.25.7 '@types/babel__core': 7.20.5 babel-preset-solid: link:packages/babel-preset-solid merge-anything: 5.1.7 - solid-js: 1.9.2 - solid-refresh: 0.6.3(solid-js@1.9.2) + solid-js: 1.9.3 + solid-refresh: 0.6.3(solid-js@1.9.3) vite: 5.4.8(@types/node@22.7.5) vitefu: 0.2.5(vite@5.4.8(@types/node@22.7.5)) transitivePeerDependencies: From df4b7e4d5ef658efd8a31f5f5544a7938fb6e472 Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Wed, 8 Jan 2025 13:15:55 -0800 Subject: [PATCH 2/2] Create many-crabs-reply.md --- .changeset/many-crabs-reply.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/many-crabs-reply.md diff --git a/.changeset/many-crabs-reply.md b/.changeset/many-crabs-reply.md new file mode 100644 index 000000000..73dd3912b --- /dev/null +++ b/.changeset/many-crabs-reply.md @@ -0,0 +1,5 @@ +--- +"solid-js": patch +--- + +Update typescript to 5.7