@streamscloud/kit 0.1.7-1771253273164 → 0.1.7-1771253652477

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,13 +5,13 @@
5
5
  *
6
6
  * NOT a runtime test — purely compile-time type checking.
7
7
  */
8
- import * as yup from 'yup';
9
- import { YupFormValidator } from '../form-validation-handler/yup-form-validator';
10
8
  import { FormValidationHandler } from '../form-validation-handler/form-validation-handler.svelte';
9
+ import { YupFormValidator } from '../form-validation-handler/yup-form-validator';
11
10
  import { emailValidationSchema } from '../validation-schemas/email-validation';
12
- import { textValidationSchema } from '../validation-schemas/text-validations';
13
11
  import { handleValidationSchema } from '../validation-schemas/handle-validations';
14
12
  import { numberValidationSchema } from '../validation-schemas/number-validations';
13
+ import { textValidationSchema } from '../validation-schemas/text-validations';
14
+ import * as yup from 'yup';
15
15
  const _loginValidator = new YupFormValidator(yup.object({
16
16
  username: emailValidationSchema(),
17
17
  password: yup.string().required()
@@ -77,8 +77,9 @@ const _verifyErrorTypes = async () => {
77
77
  void _passwordError;
78
78
  void _badField;
79
79
  };
80
- // Schema validates 'baz' which doesn't exist on ModelA — compiles fine
81
- // because Yup's ObjectSchema generics never enforced field matching
80
+ // Schema validates 'baz' which doesn't exist on ModelA — correctly fails!
81
+ // With ObjectSchema<Partial<T>, any, any, any> this mismatch is now caught.
82
+ // @ts-expect-error — schema fields don't match ModelA
82
83
  const _mismatchedValidator = new YupFormValidator(yup.object({ baz: yup.string().required() }));
83
84
  // Prevent unused variable warnings
84
85
  void _loginValidator;
@@ -1,9 +1,9 @@
1
1
  import type { FormValidateResult, IFormHandlerValidator } from './types';
2
- import type { AnyObjectSchema } from 'yup';
2
+ import type { ObjectSchema } from 'yup';
3
3
  export declare class YupFormValidator<T> implements IFormHandlerValidator<T> {
4
4
  private validationSchema;
5
5
  private validationOptions;
6
- constructor(validationSchema: AnyObjectSchema, validationOptions?: {
6
+ constructor(validationSchema: ObjectSchema<Partial<T>, any, any, any>, validationOptions?: {
7
7
  trimErrorPath: boolean;
8
8
  });
9
9
  validate: (obj: T) => Promise<FormValidateResult<Partial<T>>>;
@@ -1,7 +1,9 @@
1
1
  export class YupFormValidator {
2
2
  validationSchema;
3
3
  validationOptions;
4
- constructor(validationSchema, validationOptions = { trimErrorPath: true }) {
4
+ constructor(
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ validationSchema, validationOptions = { trimErrorPath: true }) {
5
7
  this.validationSchema = validationSchema;
6
8
  this.validationOptions = validationOptions;
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.1.7-1771253273164",
3
+ "version": "0.1.7-1771253652477",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",