remult 3.3.15 → 3.3.16

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "3.3.15",
3
+ "version": "3.3.16",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -111,8 +111,8 @@ export interface FieldOptions<entityType = unknown, valueType = unknown> {
111
111
  valueConverter?: ValueConverter<valueType>;
112
112
  /** an arrow function that translates the value to a display value */
113
113
  displayValue?: (entity: entityType, value: valueType) => string;
114
- /** an arrow function that determines the default value of the field, when the entity is created using the `repo.create` method */
115
- defaultValue?: (entity: entityType) => valueType;
114
+ /** The default value of the field, when the entity is created using the `repo.create` method — a value or an arrow function that computes it */
115
+ defaultValue?: valueType | ((entity: entityType) => valueType);
116
116
  /** The html input type for this field */
117
117
  inputType?: string;
118
118
  /**
@@ -1211,7 +1211,13 @@ export interface ClassDecoratorContextStub<Class extends new (...args: any) => a
1211
1211
  readonly name: string | undefined;
1212
1212
  addInitializer(initializer: (this: Class) => void): void;
1213
1213
  }
1214
- export type ClassFieldDecorator<entityType, valueType> = (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
1214
+ export type ClassFieldDecorator<entityType, valueType> = ((target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void) & {
1215
+ /** Phantom type brand (never set at runtime). Without it the decorator is a
1216
+ * bare function type, which TypeScript skips as an inference candidate when
1217
+ * a `Fields.xxx()` call appears in a generically-inferred object alongside a
1218
+ * context-sensitive function — e.g. UI schemas built from field decorators. */
1219
+ readonly __fieldValueType?: valueType;
1220
+ };
1215
1221
  export declare const flags: {
1216
1222
  error500RetryCount: number;
1217
1223
  };