Skip to content

Commit

Permalink
Rename Inferred Function and Constructor Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 committed Apr 24, 2024
1 parent 6ba7c92 commit a7a7955
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/type/constructor/constructor.ts
Expand Up @@ -53,7 +53,7 @@ type StaticParameters<T extends TSchema[], P extends unknown[], Acc extends unkn
)
// prettier-ignore
type StaticConstructor<T extends TSchema[], U extends TSchema, P extends unknown[]> =
Ensure<new (...params: StaticParameters<T, P>) => StaticReturnType<U, P>>
Ensure<new (...param: StaticParameters<T, P>) => StaticReturnType<U, P>>
// ------------------------------------------------------------------
// TConstructor
// ------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/type/function/function.ts
Expand Up @@ -53,7 +53,7 @@ type StaticParameters<T extends TSchema[], P extends unknown[], Acc extends unkn
)
// prettier-ignore
type StaticFunction<T extends TSchema[], U extends TSchema, P extends unknown[]> =
Ensure<(...params: StaticParameters<T, P>) => StaticReturnType<U, P>>
Ensure<(...param: StaticParameters<T, P>) => StaticReturnType<U, P>>

// ------------------------------------------------------------------
// TFunction
Expand Down
14 changes: 8 additions & 6 deletions test/runtime/value/clean/union.ts
Expand Up @@ -137,17 +137,19 @@ describe('value/clean/Union', () => {
// https://github.com/sinclairzx81/typebox/issues/845
// ----------------------------------------------------------------
it('Should clean recursive with union', () => {
const T = Type.Recursive((This) => Type.Object({
id: Type.Number(),
parent: Type.Union([This, Type.Null()]),
}))
const R = Value.Clean(T, {
const T = Type.Recursive((This) =>
Type.Object({
id: Type.Number(),
parent: Type.Union([This, Type.Null()]),
}),
)
const R = Value.Clean(T, {
id: 1,
unknown: 1,
parent: {
id: 2,
unknown: 1,
parent: null
parent: null,
},
})
Assert.IsEqual(R, { id: 1, parent: { id: 2, parent: null } })
Expand Down

0 comments on commit a7a7955

Please sign in to comment.