Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/xstate/src/types.ts>NonReducibleUnknown

State machines and statecharts for the modern web.
Go to Latest
type alias NonReducibleUnknown
import { type NonReducibleUnknown } from "https://deno.land/x/xstate@xstate@5.0.0-beta.23/src/types.ts";

T | unknown reduces to unknown and that can be problematic when it comes to contextual typing. It especially is a problem when the union has a function member, like here:

declare function test(cbOrVal: ((arg: number) => unknown) | unknown): void;
test((arg) => {}) // oops, implicit any

This type can be used to avoid this problem. This union represents the same value space as unknown.

definition: { } | null | undefined