Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): use Simplify in TIntersect for better type readability #784

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/type/intersect/intersect-type.ts
Expand Up @@ -30,6 +30,8 @@ import type { TSchema, SchemaOptions } from '../schema/index'
import type { Static } from '../static/index'
import { Kind } from '../symbols/index'

type Simplify<T> = {} & { [P in keyof T]: T[P] }

// ------------------------------------------------------------------
// IntersectStatic
// ------------------------------------------------------------------
Expand All @@ -50,7 +52,7 @@ export interface IntersectOptions extends SchemaOptions {
// prettier-ignore
export interface TIntersect<T extends TSchema[] = TSchema[]> extends TSchema, IntersectOptions {
[Kind]: 'Intersect'
static: TIntersectStatic<T, this['params']>
static: Simplify<TIntersectStatic<T, this['params']>>
type?: 'object'
allOf: [...T]
}