<commit_before>type CommonPropertyProps = {
  title?: string;
  uniforms?: object;
  // tslint:disable-next-line:no-any
  [key: string]: any;
};
type BooleanType = {
  type: 'boolean';
} & CommonPropertyProps;
type StringProperty = {
  type: 'string';
  minLength?: number;
  maxLength?: number;
  pattern?: string;
} & CommonPropertyProps;

type NumberProperty = {
  type: 'number' | 'integer';
  minimum?: number;
  maximum?: number;
  multipleOf?: number;
  exclusiveMaximum?: boolean;
} & CommonPropertyProps;

type Property<T> = T extends object
  ? JsonSchema<T>
  : T extends string
  ? StringProperty
  : T extends number
  ? NumberProperty
  : T extends boolean
  ? BooleanType
  : never;

export type JsonSchema<T extends object> = {
  title?: string;
  type: 'object';
  properties: { [K in keyof T]-?: Property<T[K]> };
  // required: string[];
  /** union to tuple conversion is expensive, we do a poor mans version here */
  required: Array<keyof T>;
};
<commit_msg>fix(ts): sub objects in jsonSchema do not allow additional props like uniforms<commit_after>type CommonPropertyProps = {
  title?: string;
  uniforms?: object;
  // tslint:disable-next-line:no-any
  [key: string]: any;
};
type BooleanType = {
  type: 'boolean';
} & CommonPropertyProps;
type StringProperty = {
  type: 'string';
  minLength?: number;
  maxLength?: number;
  pattern?: string;
} & CommonPropertyProps;

type NumberProperty = {
  type: 'number' | 'integer';
  minimum?: number;
  maximum?: number;
  multipleOf?: number;
  exclusiveMaximum?: boolean;
} & CommonPropertyProps;

type ObjectProperty<T extends object> = JsonSchema<T> & CommonPropertyProps;
type Property<T> = T extends object
  ? ObjectProperty<T>
  : T extends string
  ? StringProperty
  : T extends number
  ? NumberProperty
  : T extends boolean
  ? BooleanType
  : never;

export type JsonSchema<T extends object> = {
  title?: string;
  type: 'object';
  properties: { [K in keyof T]-?: Property<T[K]> };
  // required: string[];
  /** union to tuple conversion is expensive, we do a poor mans version here */
  required: Array<keyof T>;
};

{'fraction_non_alphanumeric': 0.13010446343779677, 'fraction_numerical': 0.0, 'mean_word_length': 4.139024390243902, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4739719', 'n_tokens_mistral': 657, 'n_tokens_neox': 651, 'n_words': 201}