Skip to content

Commit fb6a848

Browse files
committed
Version 1.0.48 (#1435)
* Parser: Prevent Socket.Dev Warning * ChangeLog * Version * Documentation
1 parent 866479b commit fb6a848

8 files changed

Lines changed: 24 additions & 17 deletions

File tree

changelog/1.0.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.0.48](https://github.com/sinclairzx81/typebox/pull/1435)
7+
- Resolve Socket.Dev False Positive | Function Signature Parser
68
- [Revision 1.0.47](https://github.com/sinclairzx81/typebox/pull/1434)
79
- Fix ReadonlyType Fallthrough Case for Non-Mappable types.
810
- [Revision 1.0.46](https://github.com/sinclairzx81/typebox/pull/1432)

design/syntax/syntax.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ const Base = Runtime.Union([
281281
Runtime.Ref('TemplateLiteral'),
282282
Runtime.Ref('Literal'),
283283
Runtime.Ref('Constructor'),
284-
Runtime.Ref('Function'),
284+
Runtime.Ref('_Function_'),
285285
Runtime.Ref('Mapped'),
286286
Runtime.Ref('Options'),
287287
Runtime.Ref('GenericCall'),
@@ -577,9 +577,9 @@ const Constructor = Runtime.Tuple([
577577
Runtime.Ref('Type')
578578
])
579579
// ------------------------------------------------------------------
580-
// Function
580+
// _Function_
581581
// ------------------------------------------------------------------
582-
const Function = Runtime.Tuple([
582+
const _Function_ = Runtime.Tuple([
583583
Runtime.Const(LParen),
584584
Runtime.Ref('ParameterList'),
585585
Runtime.Const(RParen),
@@ -993,7 +993,7 @@ export const SyntaxModule = new Runtime.Module({
993993
ParameterBase,
994994
Parameter,
995995
ParameterList,
996-
Function,
996+
_Function_,
997997
Constructor,
998998

999999
MappedReadonly,

design/website/docs/script/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Script
22

3-
TypeScript Runtime Scripting Engine
3+
Parse TypeScript into Json Schema
44

55
## Overview
66

7-
TypeBox can translate TypeScript syntax into Json Schema. The Script function is a fully type-safe, syntactic frontend to the TypeBox type builder API, allowing Json Schema to be constructed and mapped using TypeScript type expressions encoded as strings.
7+
TypeBox can parse TypeScript syntax into Json Schema. The Script function is designed to be syntactic frontend to the TypeBox type builder API, enabling Json Schema to be both constructed and mapped using TypeScript type expressions encoded in template literal strings.
88

99
### Example
1010

docs/docs/script/overview.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>Script</h1>
2-
<p>TypeScript Runtime Scripting Engine</p>
2+
<p>Parse TypeScript into Json Schema</p>
33
<h2>Overview</h2>
4-
<p>TypeBox can translate TypeScript syntax into Json Schema. The Script function is a fully type-safe, syntactic frontend to the TypeBox type builder API, allowing Json Schema to be constructed and mapped using TypeScript type expressions encoded as strings.</p>
4+
<p>TypeBox can parse TypeScript syntax into Json Schema. The Script function is designed to be syntactic frontend to the TypeBox type builder API, enabling Json Schema to be both constructed and mapped using TypeScript type expressions encoded in template literal strings.</p>
55
<h3>Example</h3>
66
<p>The following uses Script to construct and map Json Schema.</p>
77
<pre><code class="language-typescript">import Type from &#39;typebox&#39;

src/type/script/mapping.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ export function ExtendsMapping(input: [unknown, unknown, unknown, unknown, unkno
528528
: []
529529
}
530530
// -------------------------------------------------------------------
531-
// Base: ['(', Type, ')'] | Keyword | _Object_ | Tuple | TemplateLiteral | Literal | Constructor | Function | Mapped | Options | GenericCall | Reference
531+
// Base: ['(', Type, ')'] | Keyword | _Object_ | Tuple | TemplateLiteral | Literal | Constructor | _Function_ | Mapped | Options | GenericCall | Reference
532532
// -------------------------------------------------------------------
533533
export type TBaseMapping<Input extends [unknown, unknown, unknown] | unknown> = (
534534
Input extends ['(', infer Type extends T.TSchema, ')'] ? Type :
@@ -1076,14 +1076,14 @@ export function ParameterListMapping(input: [unknown, unknown]): unknown {
10761076
return Delimited(input)
10771077
}
10781078
// -------------------------------------------------------------------
1079-
// Function: ['(', ParameterList, ')', '=>', Type]
1079+
// _Function_: ['(', ParameterList, ')', '=>', Type]
10801080
// -------------------------------------------------------------------
1081-
export type TFunctionMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (
1081+
export type T_Function_Mapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (
10821082
Input extends ['(', infer ParameterList extends T.TSchema[], ')', '=>', infer ReturnType extends T.TSchema]
10831083
? T.TFunction<ParameterList, ReturnType>
10841084
: never
10851085
)
1086-
export function FunctionMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown {
1086+
export function _Function_Mapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown {
10871087
return T.Function(input[1] as T.TSchema[], input[4] as T.TSchema)
10881088
}
10891089
// -------------------------------------------------------------------

src/type/script/parser.ts

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Range } from './task/range/index.ts'
88
import { Metrics } from './task/metrics/index.ts'
99
import { Task } from 'tasksmith'
1010

11-
const Version = '1.0.47'
11+
const Version = '1.0.48'
1212

1313
// ------------------------------------------------------------------
1414
// Build

test/typebox/runtime/type/engine/action/keyof.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Test('Should KeyOf 2', () => {
2222
y: Type.Number(),
2323
z: Type.Number()
2424
})
25+
// DENO_CACHE_ERROR
2526
const T: Type.TUnion<[
2627
Type.TLiteral<'x'>,
2728
Type.TLiteral<'y'>,
@@ -59,6 +60,7 @@ Test('Should KeyOf 5', () => {
5960
Type.Object({ y: Type.Number() }),
6061
Type.Object({ z: Type.Number() })
6162
])
63+
// DENO_CACHE_ERROR
6264
const T: Type.TUnion<[
6365
Type.TLiteral<'x'>,
6466
Type.TLiteral<'y'>,
@@ -100,6 +102,7 @@ Test('Should KeyOf 8', () => {
100102
Type.Object({ z: Type.Number() })
101103
])
102104
])
105+
// DENO_CACHE_ERROR
103106
const T: Type.TUnion<[Type.TLiteral<'x'>, Type.TLiteral<'b'>]> = Type.KeyOf(A)
104107
Assert.IsTrue(Type.IsUnion(T))
105108
Assert.IsEqual(T.anyOf[0].const, 'x')
@@ -114,6 +117,7 @@ Test('Should KeyOf 9', () => {
114117
Type.Object({ z: Type.Number() })
115118
])
116119
]))
120+
// DENO_CACHE_ERROR
117121
const T: Type.TUnion<[Type.TLiteral<'x'>, Type.TLiteral<'b'>]> = Type.KeyOf(A)
118122
Assert.IsTrue(Type.IsUnion(T))
119123
Assert.IsEqual(T.anyOf[0].const, 'x')
@@ -173,6 +177,7 @@ Test('Should KeyOf 12', () => {
173177
Type.Object({ x: Type.Number(), y: Type.String() }),
174178
Type.Object({ x: Type.Number(), y: Type.String() })
175179
]))
180+
// DENO_CACHE_ERROR
176181
const T: Type.TUnion<[Type.TLiteral<'x'>, Type.TLiteral<'y'>]> = Type.KeyOf(A)
177182
Assert.IsTrue(Type.IsUnion(T))
178183
Assert.IsEqual(T.anyOf[0].const, 'x')

0 commit comments

Comments
 (0)