aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Schema.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-04-23 18:35:59 -0400
committerbobzel <zzzman@gmail.com>2024-04-23 18:35:59 -0400
commit9d69ab27de83ead3e499edc9028ba85749407a1e (patch)
treefb7337fc899549665d6c7634435bc7ce518a58f9 /src/fields/Schema.ts
parent9e809f8748d1812bb03ec6471aa6f97467f8f75a (diff)
more lint cleanup
Diffstat (limited to 'src/fields/Schema.ts')
-rw-r--r--src/fields/Schema.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/fields/Schema.ts b/src/fields/Schema.ts
index ed603e5de..7217bec37 100644
--- a/src/fields/Schema.ts
+++ b/src/fields/Schema.ts
@@ -1,3 +1,7 @@
+/* eslint-disable guard-for-in */
+/* eslint-disable no-restricted-syntax */
+/* eslint-disable no-redeclare */
+/* eslint-disable no-use-before-define */
import { Interface, ToInterface, Cast, ToConstructor, HasTail, Head, Tail, ListSpec, ToType, DefaultFieldConstructor } from './Types';
import { Doc, FieldType } from './Doc';
import { ObjectField } from './ObjectField';
@@ -12,6 +16,7 @@ type AllToInterface<T extends Interface[]> = {
export const emptySchema = createSchema({});
export const Document = makeInterface(emptySchema);
+// eslint-disable-next-line no-redeclare
export type Document = makeInterface<[typeof emptySchema]>;
export interface InterfaceFunc<T extends Interface[]> {
@@ -39,6 +44,7 @@ export function makeInterface<T extends Interface[]>(...schemas: T): InterfaceFu
// defaultSpec
return Cast(field, desc.type, desc.defaultVal);
}
+ // eslint-disable-next-line no-prototype-builtins
if (typeof desc === 'function' && !ObjectField.isPrototypeOf(desc) && !RefField.isPrototypeOf(desc)) {
const doc = Cast(field, Doc);
if (doc === undefined) {
@@ -73,8 +79,8 @@ export function makeStrictInterface<T extends Interface>(schema: T): (doc: Doc)
get() {
return Cast(this.__doc[key], type as any);
},
- set(value) {
- value = Cast(value, type as any);
+ set(setValue) {
+ const value = Cast(setValue, type as any);
if (value !== undefined) {
this.__doc[key] = value;
return;
@@ -93,14 +99,15 @@ export function makeStrictInterface<T extends Interface>(schema: T): (doc: Doc)
};
}
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function createSchema<T extends Interface>(schema: T): T & { proto: ToConstructor<Doc> } {
return undefined as any;
- (schema as any).proto = Doc;
- return schema as any;
+ // (schema as any).proto = Doc;
+ // return schema as any;
}
export function listSpec<U extends ToConstructor<FieldType>>(type: U): ListSpec<ToType<U>> {
- return { List: type as any }; //TODO Types
+ return { List: type as any }; // TODO Types
}
export function defaultSpec<T extends ToConstructor<FieldType>>(type: T, defaultVal: ToType<T>): DefaultFieldConstructor<ToType<T>> {