Skip to content

Commit 03a36dd

Browse files
authored
Version 1.1.28 (#1582)
* Type Engine Optimization * ChangeLog * Version
1 parent 0133310 commit 03a36dd

86 files changed

Lines changed: 1419 additions & 1251 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog/1.1.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
---
44

55
### Version Updates
6+
- [Revision 1.1.28](https://github.com/sinclairzx81/typebox/pull/1582)
7+
- Type Engine Optimization
68
- [Revision 1.1.27](https://github.com/sinclairzx81/typebox/pull/1580)
79
- Inference Optimization for XStaticProperties
810
- [Revision 1.1.26](https://github.com/sinclairzx81/typebox/pull/1578)

design/website/docs/type/readonly-type.md renamed to design/website/docs/type/readonly-object.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Type.ReadonlyType
1+
# Type.ReadonlyObject
22

3-
This type is an alias for the `Readonly<T>` TypeScript utility type. It makes all properties of an Object `readonly` or marks an Array or Tuple as immutable `readonly T[]`.
3+
This type is an alias for TypeScript's `Readonly<T>` utility type. It will make all properties of a TObject readonly or marks an TArray or TTuple as immutable `readonly T[]`.
44

55
## Example
66

@@ -13,7 +13,7 @@ const T = Type.Object({ // const T = TObject<{
1313
z: Type.Number() // z: TNumber,
1414
}) // }>
1515

16-
const S = Type.ReadonlyType(T) // const S: TObject<{
16+
const S = Type.ReadonlyObject(T) // const S: TObject<{
1717
// x: TReadonly<TNumber>,
1818
// y: TReadonly<TNumber>,
1919
// z: TReadonly<TNumber>
@@ -28,7 +28,7 @@ const T = Type.Tuple([ // const T = TImmutable<TTup
2828
Type.String(), // TString
2929
]) // ]>>
3030

31-
const S = Type.ReadonlyType(T) // const S: TImmutable<TTuple<[
31+
const S = Type.ReadonlyObject(T) // const S: TImmutable<TTuple<[
3232
// TNumber,
3333
// TString
3434
// }>>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<h1>Type.ReadonlyType</h1>
2-
<p>This type is an alias for the <code>Readonly&lt;T&gt;</code> TypeScript utility type. It makes all properties of an Object <code>readonly</code> or marks an Array or Tuple as immutable <code>readonly T[]</code>.</p>
1+
<h1>Type.ReadonlyObject</h1>
2+
<p>This type is an alias for TypeScript&#39;s <code>Readonly&lt;T&gt;</code> utility type. It will make all properties of a TObject readonly or marks an TArray or TTuple as immutable <code>readonly T[]</code>.</p>
33
<h2>Example</h2>
44
<p>When applied to a Object, each property of the Object will be marked as <code>TReadonly&lt;T&gt;</code></p>
55
<pre><code class="language-typescript">const T = Type.Object({ // const T = TObject&lt;{
@@ -8,7 +8,7 @@ <h2>Example</h2>
88
z: Type.Number() // z: TNumber,
99
}) // }&gt;
1010

11-
const S = Type.ReadonlyType(T) // const S: TObject&lt;{
11+
const S = Type.ReadonlyObject(T) // const S: TObject&lt;{
1212
// x: TReadonly&lt;TNumber&gt;,
1313
// y: TReadonly&lt;TNumber&gt;,
1414
// z: TReadonly&lt;TNumber&gt;
@@ -20,7 +20,7 @@ <h2>Example</h2>
2020
Type.String(), // TString
2121
]) // ]&gt;&gt;
2222

23-
const S = Type.ReadonlyType(T) // const S: TImmutable&lt;TTuple&lt;[
23+
const S = Type.ReadonlyObject(T) // const S: TImmutable&lt;TTuple&lt;[
2424
// TNumber,
2525
// TString
2626
// }&gt;&gt;

docs/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"partial": "docs/type/partial.html",
112112
"pick": "docs/type/pick.html",
113113
"promise": "docs/type/promise.html",
114-
"readonly-type": "docs/type/readonly-type.html",
114+
"readonly-object": "docs/type/readonly-object.html",
115115
"readonly": "docs/type/readonly.html",
116116
"record": "docs/type/record.html",
117117
"ref": "docs/type/ref.html",

src/type/action/awaited.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
// deno-lint-ignore-file ban-types
3029
// deno-fmt-ignore-file
3130

3231
import { type TSchema, type TSchemaOptions } from '../types/schema.ts'
3332
import { type TDeferred, Deferred } from '../types/deferred.ts'
34-
import { type TInstantiate, Instantiate } from '../engine/instantiate.ts'
33+
import { type TAwaitedAction, AwaitedAction } from '../engine/awaited/instantiate.ts'
3534

3635
// ------------------------------------------------------------------
3736
// Deferred
@@ -49,9 +48,9 @@ export function AwaitedDeferred<Type extends TSchema>(type: Type, options: TSche
4948
// ------------------------------------------------------------------
5049
/** Applies an Awaited action to a type. */
5150
export type TAwaited<Type extends TSchema> = (
52-
TInstantiate<{}, TAwaitedDeferred<Type>>
51+
TAwaitedAction<Type>
5352
)
5453
/** Applies an Awaited action to a type. */
5554
export function Awaited<Type extends TSchema>(type: Type, options: TSchemaOptions = {}): TAwaited<Type> {
56-
return Instantiate({}, AwaitedDeferred(type, options)) as never
55+
return AwaitedAction(type, options)
5756
}

src/type/action/capitalize.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
// deno-lint-ignore-file ban-types
3029
// deno-fmt-ignore-file
3130

3231
import { type TSchema, type TSchemaOptions } from '../types/schema.ts'
3332
import { type TDeferred, Deferred } from '../types/deferred.ts'
34-
import { type TInstantiate, Instantiate } from '../engine/instantiate.ts'
33+
import { type TCapitalizeAction, CapitalizeAction } from '../engine/intrinsics/instantiate.ts'
3534

3635
// ------------------------------------------------------------------
3736
// Deferred
@@ -49,9 +48,9 @@ export function CapitalizeDeferred<Type extends TSchema>(type: Type, options: TS
4948
// ------------------------------------------------------------------
5049
/** Applies a Capitalize action to the given type. */
5150
export type TCapitalize<Type extends TSchema> = (
52-
TInstantiate<{}, TCapitalizeDeferred<Type>>
51+
TCapitalizeAction<Type>
5352
)
5453
/** Applies a Capitalize action to the given type. */
5554
export function Capitalize<Type extends TSchema>(type: Type, options: TSchemaOptions = {}): TCapitalize<Type> {
56-
return Instantiate({}, CapitalizeDeferred(type, options)) as never
55+
return CapitalizeAction(type, options)
5756
}

src/type/action/conditional.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ THE SOFTWARE.
3131

3232
import { type TSchema, type TSchemaOptions } from '../types/schema.ts'
3333
import { type TDeferred, Deferred } from '../types/deferred.ts'
34-
import { type TInstantiate, Instantiate } from '../engine/instantiate.ts'
34+
import { type TConditionalAction, ConditionalAction } from '../engine/conditional/instantiate.ts'
3535

3636
// ------------------------------------------------------------------
3737
// Deferred
@@ -41,17 +41,21 @@ export type TConditionalDeferred<Left extends TSchema, Right extends TSchema, Tr
4141
TDeferred<'Conditional', [Left, Right, True, False]>
4242
)
4343
/** Creates a deferred Conditional action. */
44-
export function ConditionalDeferred<Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema>(left: Left, right: Right, true_: True, false_: False, options: TSchemaOptions = {}): TConditionalDeferred<Left, Right, True, False> {
44+
export function ConditionalDeferred<Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema>
45+
(left: Left, right: Right, true_: True, false_: False, options: TSchemaOptions = {}):
46+
TConditionalDeferred<Left, Right, True, False> {
4547
return Deferred('Conditional', [left, right, true_, false_], options) as never
4648
}
4749
// ------------------------------------------------------------------
4850
// Type
4951
// ------------------------------------------------------------------
5052
/** Applies a Conditional action to the given types. */
5153
export type TConditional<Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema> = (
52-
TInstantiate<{}, TConditionalDeferred<Left, Right, True, False>>
54+
TConditionalAction<{}, { callstack: [] }, Left, Right, True, False>
5355
)
5456
/** Applies a Conditional action to the given types. */
55-
export function Conditional<Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema>(left: Left, right: Right, true_: True, false_: False, options: TSchemaOptions = {}): TConditional<Left, Right, True, False> {
56-
return Instantiate({}, ConditionalDeferred(left, right, true_, false_, options)) as never
57+
export function Conditional<Left extends TSchema, Right extends TSchema, True extends TSchema, False extends TSchema>
58+
(left: Left, right: Right, true_: True, false_: False, options: TSchemaOptions = {}):
59+
TConditional<Left, Right, True, False> {
60+
return ConditionalAction({}, { callstack: [] }, left, right, true_, false_, options)
5761
}

src/type/action/constructor-parameters.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
// deno-lint-ignore-file ban-types
3029
// deno-fmt-ignore-file
3130

3231
import { type TSchema, type TSchemaOptions } from '../types/schema.ts'
3332
import { type TDeferred, Deferred } from '../types/deferred.ts'
34-
import { type TInstantiate, Instantiate } from '../engine/instantiate.ts'
33+
import { type TConstructorParametersAction, ConstructorParametersAction } from '../engine/constructor-parameters/instantiate.ts'
3534

3635
// ------------------------------------------------------------------
3736
// Deferred
@@ -49,9 +48,9 @@ export function ConstructorParametersDeferred<Type extends TSchema>(type: Type,
4948
// ------------------------------------------------------------------
5049
/** Applies a ConstructorParameters action to a type. */
5150
export type TConstructorParameters<Type extends TSchema> = (
52-
TInstantiate<{}, TConstructorParametersDeferred<Type>>
51+
TConstructorParametersAction<Type>
5352
)
5453
/** Applies a ConstructorParameters action to a type. */
5554
export function ConstructorParameters<Type extends TSchema>(type: Type, options: TSchemaOptions = {}): TConstructorParameters<Type> {
56-
return Instantiate({}, ConstructorParametersDeferred(type, options)) as never
55+
return ConstructorParametersAction(type, options)
5756
}

src/type/action/evaluate.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
// deno-lint-ignore-file ban-types
3029
// deno-fmt-ignore-file
3130

3231
import { type TSchema, type TSchemaOptions } from '../types/schema.ts'
3332
import { type TDeferred, Deferred } from '../types/deferred.ts'
34-
import { type TInstantiate, Instantiate } from '../engine/instantiate.ts'
33+
import { type TEvaluateAction, EvaluateAction } from '../engine/evaluate/instantiate.ts'
3534

3635
// ------------------------------------------------------------------
3736
// Deferred
@@ -49,9 +48,9 @@ export function EvaluateDeferred<Type extends TSchema>(type: Type, options: TSch
4948
// ------------------------------------------------------------------
5049
/** Applies an Evaluate action to a type. */
5150
export type TEvaluate<Type extends TSchema> = (
52-
TInstantiate<{}, TEvaluateDeferred<Type>>
51+
TEvaluateAction<Type>
5352
)
5453
/** Applies an Evaluate action to a type. */
5554
export function Evaluate<Type extends TSchema>(type: Type, options: TSchemaOptions = {}): TEvaluate<Type> {
56-
return Instantiate({}, EvaluateDeferred(type, options)) as never
55+
return EvaluateAction(type, options)
5756
}

src/type/action/exclude.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
// deno-lint-ignore-file ban-types
3029
// deno-fmt-ignore-file
3130

3231
import { type TSchema, type TSchemaOptions } from '../types/schema.ts'
3332
import { type TDeferred, Deferred } from '../types/deferred.ts'
34-
import { type TInstantiate, Instantiate } from '../engine/instantiate.ts'
33+
import { type TExcludeAction, ExcludeAction } from '../engine/exclude/instantiate.ts'
3534

3635
// ------------------------------------------------------------------
3736
// Deferred
@@ -49,9 +48,9 @@ export function ExcludeDeferred<Left extends TSchema, Right extends TSchema>(lef
4948
// ------------------------------------------------------------------
5049
/** Applies a Exclude action using the given types */
5150
export type TExclude<Left extends TSchema, Right extends TSchema> = (
52-
TInstantiate<{}, TExcludeDeferred<Left, Right>>
51+
TExcludeAction<Left, Right>
5352
)
5453
/** Applies a Exclude action using the given types */
5554
export function Exclude<Left extends TSchema, Right extends TSchema>(left: Left, right: Right, options: TSchemaOptions = {}): TExclude<Left, Right> {
56-
return Instantiate({}, ExcludeDeferred(left, right, options)) as never
55+
return ExcludeAction(left, right, options)
5756
}

0 commit comments

Comments
 (0)