You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, we may want to have a function that read one field of an object identified by a parameter. Here is a small synthetic use case, for the purpose of the discussion:
In that particular case, the type checker cannot ensure that we are doing things right. In order to make the type checker happy, we need a way to tell it that format is actually part of an implicit enumeration that only contains the names of the fields of the interface Help. This could be done by introducing a new type inference operator, for example fieldof.
This may not look like a very common use case, but I hoped to have such an operator in order to port incrementally a large amount of javascript code to typescript.
The text was updated successfully, but these errors were encountered:
In some cases, we may want to have a function that read one field of an object identified by a parameter. Here is a small synthetic use case, for the purpose of the discussion:
In that particular case, the type checker cannot ensure that we are doing things right. In order to make the type checker happy, we need a way to tell it that
format
is actually part of an implicit enumeration that only contains the names of the fields of the interfaceHelp
. This could be done by introducing a new type inference operator, for examplefieldof
.This may not look like a very common use case, but I hoped to have such an operator in order to port incrementally a large amount of javascript code to typescript.
The text was updated successfully, but these errors were encountered: