@@ -543,8 +543,15 @@ and we want typechecking to match.
543543Type operators
544544--------------
545545
546- Note that in some sections below we write things like ``Literal[int] `` to mean
547- "a literal that is of type ``int ``".
546+ Many of the operators specified have type bounds listed for some of
547+ their operands. These should be interpreted more as documentation than
548+ as exact type bounds. Trying to evaluate operators with invalid
549+ arguments will produce ``Never `` as the return. (There is some
550+ discussion of potential alternatives :ref: `below <strict-kinds >`.)
551+
552+ Note that in some of these bounds below we write things like
553+ ``Literal[int] `` to mean "a literal that is of type ``int ``".
554+ We don't propose to add that as actula syntax yet.
548555
549556.. _boolean-ops :
550557
@@ -1644,16 +1651,20 @@ not yet integrated into the main proposal) would improve the syntactic
16441651situation at lower cost.
16451652
16461653
1654+ .. _strict-kinds :
1655+
16471656Make the type-level operations more "strictly-typed"
16481657----------------------------------------------------
16491658
16501659This proposal is less "strictly-typed" than TypeScript
16511660(strictly-kinded, maybe?).
16521661
16531662TypeScript has better typechecking at the alias definition site:
1654- For ``P[K] ``, ``K `` needs to have ``keyof P ``...
1663+ For ``P[K] ``, ``K `` needs to have ``keyof P ``. The ``extends ``
1664+ conditional type operator narrows the type to help spuport this.
16551665
1656- We could do potentially better but it would require more machinery.
1666+ We could do potentially better but it would require quite a bit more
1667+ machinery.
16571668
16581669* ``KeyOf[T] `` - literal keys of ``T ``
16591670* ``Member[T] ``, when statically checking a type alias, could be
0 commit comments