''iDocumentStore' only refers to a type, but is being used as a value here
I have an interface:
export interface iDocumentStore {
hasSpaceInfo: boolean;
docId: string;
}
I get the following error when trying to do
@property({ type: iDocumentStore })
Is there a way to specify a type interface for a property?
I'm create a web component using lit element.
Solution 1:[1]
The type option for properties is a JavaScript type that Lit uses to convert a string attribute into a property and the property value into a string attribute at runtime. It is not not the same as TypeScript's type checking. You'll want to specify the TypeScript type as usual on the property and if the value will convert to/from JSON you can specify Object as the type for Lit to convert at runtime.
@property({ type: Object })
doc?: iDocumentStore;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | abraham |
