diff --git a/changelog.md b/changelog.md index 5034c30..6a6e9ac 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,15 @@ +## [0.25.23](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.23) + +Updates: + +- [324](https://github.com/sinclairzx81/typebox/pull/324) TypeScript Language Service now presents JSDoc comments when inferring static object properties. (IntelliSense) +- [325](https://github.com/sinclairzx81/typebox/pull/325) Additional property inference optimizations. + +Additional: + +- Huge thank you to Github user [stevezhu](https://github.com/stevezhu) for these excellent contributions. + + ## [0.25.22](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.22) Updates: diff --git a/example/index.ts b/example/index.ts index 588558a..75d4d61 100644 --- a/example/index.ts +++ b/example/index.ts @@ -9,6 +9,7 @@ import { Value, ValuePointer } from '@sinclair/typebox/value' import { Type, Kind, Static, TSchema } from '@sinclair/typebox' const T = Type.Object({ + /** It's a X */ x: Type.Number(), y: Type.Number(), z: Type.Number(), diff --git a/package.json b/package.json index 9f54111..b9a59fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sinclair/typebox", - "version": "0.25.22", + "version": "0.25.23", "description": "JSONSchema Type Builder with Static Type Resolution for TypeScript", "keywords": [ "typescript", diff --git a/src/typebox.ts b/src/typebox.ts index a425d36..e5fb7ff 100644 --- a/src/typebox.ts +++ b/src/typebox.ts @@ -315,11 +315,17 @@ export type OptionalPropertyKeys = { [K in keyof T]: T[K] export type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys> // prettier-ignore -export type PropertiesReduce = - Readonly }, ReadonlyOptionalPropertyKeys>>> & - Readonly }, ReadonlyPropertyKeys>> & - Partial }, OptionalPropertyKeys>> & - Required }, RequiredPropertyKeys>> extends infer R ? { [K in keyof R]: R[K] } : never +export type PropertiesReducer> = ( + Readonly>>> & + Readonly>> & + Partial>> & + Required>> +) extends infer O ? { [K in keyof O]: O[K] } : never + +// prettier-ignore +export type PropertiesReduce = PropertiesReducer +}> export type TRecordProperties, T extends TSchema> = Static extends string ? { [X in Static]: T } : never