Skip to content

Commit

Permalink
Applied PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
radekmie committed Jan 10, 2023
1 parent 46c3ed2 commit 5a0a795
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 56 deletions.
11 changes: 6 additions & 5 deletions packages/uniforms-antd/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-antd/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-bootstrap3/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-bootstrap3/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-bootstrap4/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-bootstrap4/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-bootstrap5/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-bootstrap5/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-material/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-material/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-mui/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-mui/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-semantic/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-semantic/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down
11 changes: 6 additions & 5 deletions packages/uniforms-unstyled/__tests__/_createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SimpleSchemaDefinition } from 'simpl-schema';
import { BaseForm, Context, UnknownObject, randomIds } from 'uniforms';
import { Context, UnknownObject, randomIds, ChangedMap } from 'uniforms';

import createSchema from './_createSchema';

Expand All @@ -9,11 +9,11 @@ export default function createContext<Model extends UnknownObject>(
schema?: SimpleSchemaDefinition,
context?: Partial<Context<Model>>,
model = {} as Model,
) {
): { context: Context<Model> } {
return {
context: {
changed: false,
changedMap: {},
changedMap: {} as ChangedMap<Model>,
error: null,
model,
name: [],
Expand All @@ -33,7 +33,8 @@ export default function createContext<Model extends UnknownObject>(
showInlineError: false,
...context?.state,
},
formRef: {} as BaseForm<Model>,
} as Context<Model>,
// @ts-expect-error We don't have a true ref in tests.
formRef: null,
},
};
}
3 changes: 1 addition & 2 deletions packages/uniforms-unstyled/src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import invariant from 'invariant';
import { ComponentType } from 'react';
export { AutoFieldProps } from 'uniforms';
import { createAutoField } from 'uniforms';

Expand All @@ -14,7 +13,7 @@ import TextField from './TextField';

const AutoField = createAutoField(props => {
if (props.component) {
return props.component as ComponentType<any>;
return props.component;
}

if (props.allowedValues) {
Expand Down

0 comments on commit 5a0a795

Please sign in to comment.