Using multiple JSONSchema types in a single file #62
-
In my Service files, I have multiple different data types that I'm fetching from localstorage via the I've defined the following:
And I get the following error when I try to use anything but 'schema' with getItem, for example:
Just using Am I going about this the wrong way, or misunderstanding how this works? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In ES6+, this: getItem<number>(keyName, { schema }) is a shortcut for this: getItem<number>(keyName, { schema: schema }) which works only if the property and the variable have the same name. So if your variable has another name, you can't use the shortcut, you need to do this: getItem<number>(keyName, { schema: schemaNum }) Added the info in doc. |
Beta Was this translation helpful? Give feedback.
In ES6+, this:
is a shortcut for this:
which works only if the property and the variable have the same name. So if your variable has another name, you can't use the shortcut, you need to do this:
Added the info in doc.