Page 1 of 1

Using a model as a Type in my typescript

Posted: Wed Oct 14, 2020 2:20 am
by kevinmcisaac

I've defined a number of models and they seem to be used like a Type when the code is being tested.

Can I use them as a Type in my own custom Typescript? I tried using syntax like "function (latlon: LatLon): LogEntry {} "

where LatLon and LogEntry are models, but this did not work


Re: Using a model as a Type in my typescript

Posted: Fri Oct 16, 2020 8:39 am
by Serhii Kulibaba

Hello Kevin,

Sorry, I don't think this is a correct declaration of the function. You can pass "any" type as a function parameter instead of the specific type