profectus-docs/assets/api_modules_util_computed.md.754b4330.js

1 line
12 KiB
JavaScript

import{_ as e,c as t,o as a,a as d}from"./app.54d5a277.js";const f='{"title":"Module: util/computed","description":"","frontmatter":{},"headers":[{"level":2,"title":"Type aliases","slug":"type-aliases"},{"level":3,"title":"Computable","slug":"computable"},{"level":3,"title":"ComputableKeysOf","slug":"computablekeysof"},{"level":3,"title":"GetComputableType","slug":"getcomputabletype"},{"level":3,"title":"GetComputableTypeWithDefault","slug":"getcomputabletypewithdefault"},{"level":3,"title":"ProcessedComputable","slug":"processedcomputable"},{"level":3,"title":"UnwrapComputableType","slug":"unwrapcomputabletype"},{"level":2,"title":"Variables","slug":"variables"},{"level":3,"title":"DoNotCache","slug":"donotcache"},{"level":2,"title":"Functions","slug":"functions"},{"level":3,"title":"convertComputable","slug":"convertcomputable"},{"level":3,"title":"processComputable","slug":"processcomputable"}],"relativePath":"api/modules/util/computed.md"}',o={},r=d('<h1 id="module-util-computed" tabindex="-1">Module: util/computed <a class="header-anchor" href="#module-util-computed" aria-hidden="true">#</a></h1><h2 id="type-aliases" tabindex="-1">Type aliases <a class="header-anchor" href="#type-aliases" aria-hidden="true">#</a></h2><h3 id="computable" tabindex="-1">Computable <a class="header-anchor" href="#computable" aria-hidden="true">#</a></h3><p>\u01AC <strong>Computable</strong>&lt;<code>T</code>&gt;: <code>T</code> | <code>Ref</code>&lt;<code>T</code>&gt; | () =&gt; <code>T</code></p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L6" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:6</a></p><hr><h3 id="computablekeysof" tabindex="-1">ComputableKeysOf <a class="header-anchor" href="#computablekeysof" aria-hidden="true">#</a></h3><p>\u01AC <strong>ComputableKeysOf</strong>&lt;<code>T</code>&gt;: <code>Pick</code>&lt;<code>T</code>, { [<code>K</code> in keyof <code>T</code>]: <code>T</code>[<code>K</code>] extends <a href="./computed.html#computable"><code>Computable</code></a>&lt;<code>unknown</code>&gt; ? <code>K</code> : <code>never</code> }[keyof <code>T</code>]&gt;</p><h4 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L20" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:20</a></p><hr><h3 id="getcomputabletype" tabindex="-1">GetComputableType <a class="header-anchor" href="#getcomputabletype" aria-hidden="true">#</a></h3><p>\u01AC <strong>GetComputableType</strong>&lt;<code>T</code>&gt;: <code>T</code> extends { <code>[DoNotCache]</code>: <code>true</code> } ? <code>T</code> : <code>T</code> extends () =&gt; infer S ? <code>Ref</code>&lt;<code>S</code>&gt; : <code>undefined</code> extends <code>T</code> ? <code>undefined</code> : <code>T</code></p><h4 id="type-parameters-2" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-2" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><h4 id="defined-in-2" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-2" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L8" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:8</a></p><hr><h3 id="getcomputabletypewithdefault" tabindex="-1">GetComputableTypeWithDefault <a class="header-anchor" href="#getcomputabletypewithdefault" aria-hidden="true">#</a></h3><p>\u01AC <strong>GetComputableTypeWithDefault</strong>&lt;<code>T</code>, <code>S</code>&gt;: <code>undefined</code> extends <code>T</code> ? <code>S</code> : <a href="./computed.html#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>NonNullable</code>&lt;<code>T</code>&gt;&gt;</p><h4 id="type-parameters-3" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-3" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr><tr><td style="text-align:left;"><code>S</code></td></tr></tbody></table><h4 id="defined-in-3" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-3" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L15" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:15</a></p><hr><h3 id="processedcomputable" tabindex="-1">ProcessedComputable <a class="header-anchor" href="#processedcomputable" aria-hidden="true">#</a></h3><p>\u01AC <strong>ProcessedComputable</strong>&lt;<code>T</code>&gt;: <code>T</code> | <code>Ref</code>&lt;<code>T</code>&gt;</p><h4 id="type-parameters-4" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-4" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><h4 id="defined-in-4" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-4" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L7" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:7</a></p><hr><h3 id="unwrapcomputabletype" tabindex="-1">UnwrapComputableType <a class="header-anchor" href="#unwrapcomputabletype" aria-hidden="true">#</a></h3><p>\u01AC <strong>UnwrapComputableType</strong>&lt;<code>T</code>&gt;: <code>T</code> extends <code>Ref</code>&lt;infer S&gt; ? <code>S</code> : <code>T</code> extends () =&gt; infer S ? <code>S</code> : <code>T</code></p><h4 id="type-parameters-5" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-5" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><h4 id="defined-in-5" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-5" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L18" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:18</a></p><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-hidden="true">#</a></h2><h3 id="donotcache" tabindex="-1">DoNotCache <a class="header-anchor" href="#donotcache" aria-hidden="true">#</a></h3><p>\u2022 <code>Const</code> <strong>DoNotCache</strong>: typeof <a href="./computed.html#donotcache"><code>DoNotCache</code></a></p><h4 id="defined-in-6" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-6" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L4" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:4</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-hidden="true">#</a></h2><h3 id="convertcomputable" tabindex="-1">convertComputable <a class="header-anchor" href="#convertcomputable" aria-hidden="true">#</a></h3><p>\u25B8 <strong>convertComputable</strong>&lt;<code>T</code>&gt;(<code>obj</code>): <a href="./computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>T</code>&gt;</p><h4 id="type-parameters-6" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-6" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>obj</code></td><td style="text-align:left;"><a href="./computed.html#computable"><code>Computable</code></a>&lt;<code>T</code>&gt;</td></tr></tbody></table><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-hidden="true">#</a></h4><p><a href="./computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>T</code>&gt;</p><h4 id="defined-in-7" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-7" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L42" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:42</a></p><hr><h3 id="processcomputable" tabindex="-1">processComputable <a class="header-anchor" href="#processcomputable" aria-hidden="true">#</a></h3><p>\u25B8 <strong>processComputable</strong>&lt;<code>T</code>, <code>S</code>&gt;(<code>obj</code>, <code>key</code>): asserts <code>obj</code> is <code>T</code> &amp; { [<code>K</code> in <code>string</code> | <code>number</code> | <code>symbol</code>]: <a href="./computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./computed.html#unwrapcomputabletype"><code>UnwrapComputableType</code></a>&lt;<code>T</code>[<code>S</code>]&gt;&gt; }</p><h4 id="type-parameters-7" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-7" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;"><code>T</code></td></tr><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">extends <code>string</code> | <code>number</code> | <code>symbol</code></td></tr></tbody></table><h4 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>obj</code></td><td style="text-align:left;"><code>T</code></td></tr><tr><td style="text-align:left;"><code>key</code></td><td style="text-align:left;"><code>S</code></td></tr></tbody></table><h4 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-hidden="true">#</a></h4><p>asserts <code>obj</code> is <code>T</code> &amp; { [<code>K</code> in <code>string</code> | <code>number</code> | <code>symbol</code>]: <a href="./computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./computed.html#unwrapcomputabletype"><code>UnwrapComputableType</code></a>&lt;<code>T</code>[<code>S</code>]&gt;&gt; }</p><h4 id="defined-in-8" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-8" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/305946e/src/util/computed.ts#L29" target="_blank" rel="noopener noreferrer">profectus/src/util/computed.ts:29</a></p>',70),c=[r];function l(s,n,h,i,p,u){return a(),t("div",null,c)}var m=e(o,[["render",l]]);export{f as __pageData,m as default};