Aleksander Efremov (2018-02-18T18:04:16.000Z)
Yes, I think that inherited checks it's also good idea.
And regading `has` I agree. Maybe better to call `requireInstance`.

18 февр. 2018 г. 22:03 пользователь "Aleksander Efremov" <mr.efrem at gmail.com>
написал:

> Yes, I think that inherited checks it's also good idea.
> And regading `has` I agree. Maybe better to call `requireInstance`.
>
> 18 февр. 2018 г. 21:43 пользователь "Mike Samuel" <mikesamuel at gmail.com>
> написал:
>
>> Must hasInstanceStrict's parameter remain untyped for a guard to complete
>> or is there a top type with an unguarded hasInstanceStrict that these
>> checks bottom out on?
>>
>> "has" to my ear sounds like it should return a boolean.  Maybe "require."
>>
>>
>>
>> On Feb 18, 2018 11:30 AM, "Aleksander Efremov" <mr.efrem at gmail.com>
>> wrote:
>>
>> It’s attempt to provide intermediate layer for implementation of runtime
>> type checking.
>>
>> ```
>> class PrimitiveNumber {
>>         static [Symbol.hasInstanceStrict](x) {
>>                 if (typeof x !== ’number’) {
>>                         throw new TypeError(‘Invalid type’);
>>                 }
>>         }
>> }
>>
>> function sum(a: PrimitiveNumber, b: PrimitiveNumber) {
>>         return a + b;
>> }
>>
>> const c: PrimitiveNumber = sum(1, 2);
>> ```
>>
>> I.e. when appears assignment of variable (const) if then follows `:
>> <class>` then JS runtime must to call method `static
>> [Symbol.hasInstanceStrict](x)` and transfer to there assignable value.
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180218/973068b0/attachment.html>
mr.efrem at gmail.com (2018-02-18T19:00:51.947Z)
Yes, I think that inherited checks it's also good idea.
And regarding `has` I agree. Maybe better to call `requireInstance`.

18 февр. 2018 г. 22:03 пользователь "Aleksander Efremov" <mr.efrem at gmail.com>
написал: