Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork68
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? |
BetaWas this translation helpful?Give feedback.
All reactions
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.
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. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
This discussion was converted from issue #62 on December 08, 2020 21:29.