@@ -970,15 +970,13 @@ definition of "resolved value".
970970
971971## Introducing type names
972972
973- It's useful to be able to refer to two types:
973+ It's useful to be able to refer to three types:
974974
975- * ` MessageValue ` : The "resolved value" type; see [ PR 728] ( https://github.com/unicode-org/message-format-wg/pull/728 ) .
976- * ` ValueType ` : This type encompasses strings, numbers, date/time values,
975+ * ` InputType ` : This type encompasses strings, numbers, date/time values,
977976all other possible implementation-specific types that input variables can be
978- assigned to,
979- and all possible implementation-specific types that custom and built-in
980- functions can construct.
981- Conceptually it's the union of an "input type" and a "formatted value".
977+ assigned to. The details are implementation-specific.
978+ * ` MessageValue ` : The "resolved value" type; see [ PR 728] ( https://github.com/unicode-org/message-format-wg/pull/728 ) .
979+ * ` ValueType ` : This type is the union of an ` InputType ` and a ` MessageValue ` .
982980
983981It's tagged with a string tag so functions can do type checks.
984982
@@ -1017,8 +1015,10 @@ that functions can operate on.
10171015The most ambitious solution is to specify
10181016a type system for MessageFormat functions.
10191017
1020- ` ValueType ` is the most general type
1018+ In this solution, ` ValueType ` is not what is defined above,
1019+ but instead is the most general type
10211020in a system of user-defined types.
1021+ (The internal definitions are omitted.)
10221022Using the function registry,
10231023each custom function could declare its own argument type
10241024and result type.
@@ -1077,6 +1077,15 @@ impractical.
10771077In the preservation model,
10781078functions "pipeline" the input through multiple calls.
10791079
1080+ The ` ValueType ` definition is different:
1081+
1082+ ``` ts
1083+ interface ValueType {
1084+ type(): string
1085+ value(): InputType | MessageValue
1086+ }
1087+ ```
1088+
10801089The resolved value interface would include both "input"
10811090and "output" methods:
10821091
@@ -1086,7 +1095,7 @@ interface MessageValue {
10861095 formatToX(): X // where X is an implementation-defined type
10871096 getInput(): ValueType
10881097 getOutput(): ValueType
1089- properties(): { [key : string ]: MessageValue }
1098+ properties(): { [key : string ]: ValueType }
10901099 selectKeys(keys : string []): string []
10911100}
10921101```
@@ -1100,7 +1109,7 @@ choose which options to pass through into the resulting
11001109Instead of using ` unknown ` as the result type of ` getValue() ` ,
11011110we use ` ValueType ` , mentioned previously.
11021111Instead of using ` unknown ` as the value type for the
1103- ` properties() ` object, we use ` MessageValue ` ,
1112+ ` properties() ` object, we use ` ValueType ` ,
11041113since options can also be full ` MessageValue ` s with their own options.
11051114
11061115Without a mechanism for type signatures,
@@ -1137,8 +1146,8 @@ number : Number -> FormattedNumber
11371146date : Date -> FormattedDate
11381147```
11391148
1140- The resolved value type would be the same as
1141- in the formatted value model.
1149+ The ` MessageValue ` type would be defined the same way
1150+ as in the formatted value model.
11421151
11431152The difference is that built-in functions
11441153would not accept a "formatted result"
0 commit comments