diff --git a/src/Core/Attribute.ts b/src/Core/Attribute.ts index 4c106e45d..376f7c44a 100644 --- a/src/Core/Attribute.ts +++ b/src/Core/Attribute.ts @@ -320,6 +320,9 @@ export class LazyAttribute extends AttributeBase Nullable, private _valuate(raw: any): () => Nullable { if (raw === null) { + if (this.declaration.notNull) { + throw new Error("this Attribute must not be null"); + } return () => null; } const v = this.converter.convert(raw, this, this.converterContext); @@ -511,6 +514,9 @@ export class StandardAttribute extends AttributeBase { +export interface IStandardAttributeDeclaration extends IAttributeDeclarationBase { converter: Name | IStandardConverterDeclaration; - default: any; - [parameters: string]: any; } /** * interface for lazy attribute declaration */ -export interface ILazyAttributeDeclaration { +export interface ILazyAttributeDeclaration extends IAttributeDeclarationBase { converter: Name | ILazyConverterDeclaration; - default: any; - [parameters: string]: any; } export type IAttributeDeclaration = IStandardAttributeDeclaration | ILazyAttributeDeclaration;