Improved typing of Creature Properties
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import type { Expand, InferType } from '/imports/api/utility/TypedSimpleSchema';
|
||||
import { TypedSimpleSchema } from '/imports/api/utility/TypedSimpleSchema';
|
||||
|
||||
const FeatureSchema = createPropertySchema({
|
||||
name: {
|
||||
@@ -30,12 +29,8 @@ const ComputedOnlyFeatureSchema = createPropertySchema({
|
||||
},
|
||||
});
|
||||
|
||||
const ComputedFeatureSchema = new SimpleSchema({})
|
||||
const ComputedFeatureSchema = TypedSimpleSchema.from({})
|
||||
.extend(FeatureSchema)
|
||||
.extend(ComputedOnlyFeatureSchema);
|
||||
|
||||
export type Feature = InferType<typeof FeatureSchema>;
|
||||
export type ComputedOnlyFeature = InferType<typeof ComputedOnlyFeatureSchema>;
|
||||
export type ComputedFeature = Expand<InferType<typeof FeatureSchema> & InferType<typeof ComputedOnlyFeatureSchema>>;
|
||||
|
||||
export { FeatureSchema, ComputedFeatureSchema, ComputedOnlyFeatureSchema }
|
||||
|
||||
Reference in New Issue
Block a user