Unit in options has error #286
Unanswered
rhit-tianr
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I followed the format on the website and tried to set the unit of the data, but it will have an error saying its type is not assignable.
My code is:
let options = {
unit:'pound',
startDate: new Date(2017, 0, 0).toISOString(), // required
endDate: new Date().toISOString(), // optional; default now
ascending: true, // optional; default false
};
And it will indicate there is an error in options:
Argument of type '{ unit: string; startDate: string; endDate: string; ascending: boolean; }' is not assignable to parameter of type 'HealthInputOptions'.
Types of property 'unit' are incompatible.
Type 'string' is not assignable to type 'HealthUnit | undefined'.ts(2345)
And this not only shows the error on getWeightSamples(), but other functions are also not able to set units. Does anyone know how to fix it?
Beta Was this translation helpful? Give feedback.
All reactions