@naturalcycles/nodejs-lib 15.97.3 → 15.97.4

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.
@@ -180,6 +180,11 @@ export declare class JSchema<OUT, Opt> implements StandardSchemaV1<unknown, OUT>
180
180
  }
181
181
  export declare class JBuilder<OUT, Opt> extends JSchema<OUT, Opt> {
182
182
  protected setErrorMessage(ruleName: string, errorMessage: string | undefined): void;
183
+ /**
184
+ * @deprecated
185
+ * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
186
+ */
187
+ castAs<T>(): JBuilder<T, Opt>;
183
188
  $schema($schema: string): this;
184
189
  $schemaDraft7(): this;
185
190
  $id($id: string): this;
@@ -385,6 +385,13 @@ export class JBuilder extends JSchema {
385
385
  this.schema.errorMessages ||= {};
386
386
  this.schema.errorMessages[ruleName] = errorMessage;
387
387
  }
388
+ /**
389
+ * @deprecated
390
+ * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
391
+ */
392
+ castAs() {
393
+ return this;
394
+ }
388
395
  $schema($schema) {
389
396
  return this.cloneAndUpdateSchema({ $schema });
390
397
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "15.97.3",
4
+ "version": "15.97.4",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@standard-schema/spec": "^1",
@@ -539,6 +539,14 @@ export class JBuilder<OUT, Opt> extends JSchema<OUT, Opt> {
539
539
  this.schema.errorMessages[ruleName] = errorMessage
540
540
  }
541
541
 
542
+ /**
543
+ * @deprecated
544
+ * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
545
+ */
546
+ override castAs<T>(): JBuilder<T, Opt> {
547
+ return this as unknown as JBuilder<T, Opt>
548
+ }
549
+
542
550
  $schema($schema: string): this {
543
551
  return this.cloneAndUpdateSchema({ $schema })
544
552
  }