@@ -980,15 +980,13 @@ definition of "resolved value".
980980
981981## Introducing type names
982982
983- It's useful to be able to refer to two types:
983+ It's useful to be able to refer to three types:
984984
985- * ` MessageValue ` : The "resolved value" type; see [ PR 728] ( https://github.com/unicode-org/message-format-wg/pull/728 ) .
986- * ` ValueType ` : This type encompasses strings, numbers, date/time values,
985+ * ` InputType ` : This type encompasses strings, numbers, date/time values,
987986all other possible implementation-specific types that input variables can be
988- assigned to,
989- and all possible implementation-specific types that custom and built-in
990- functions can construct.
991- Conceptually it's the union of an "input type" and a "formatted value".
987+ assigned to. The details are implementation-specific.
988+ * ` MessageValue ` : The "resolved value" type; see [ PR 728] ( https://github.com/unicode-org/message-format-wg/pull/728 ) .
989+ * ` ValueType ` : This type is the union of an ` InputType ` and a ` MessageValue ` .
992990
993991It's tagged with a string tag so functions can do type checks.
994992
@@ -1027,8 +1025,10 @@ that functions can operate on.
10271025The most ambitious solution is to specify
10281026a type system for MessageFormat functions.
10291027
1030- ` ValueType ` is the most general type
1028+ In this solution, ` ValueType ` is not what is defined above,
1029+ but instead is the most general type
10311030in a system of user-defined types.
1031+ (The internal definitions are omitted.)
10321032Using the function registry,
10331033each custom function could declare its own argument type
10341034and result type.
@@ -1087,6 +1087,15 @@ impractical.
10871087In the preservation model,
10881088functions "pipeline" the input through multiple calls.
10891089
1090+ The ` ValueType ` definition is different:
1091+
1092+ ``` ts
1093+ interface ValueType {
1094+ type(): string
1095+ value(): InputType | MessageValue
1096+ }
1097+ ```
1098+
10901099The resolved value interface would include both "input"
10911100and "output" methods:
10921101
@@ -1096,7 +1105,7 @@ interface MessageValue {
10961105 formatToX(): X // where X is an implementation-defined type
10971106 getInput(): ValueType
10981107 getOutput(): ValueType
1099- properties(): { [key : string ]: MessageValue }
1108+ properties(): { [key : string ]: ValueType }
11001109 selectKeys(keys : string []): string []
11011110}
11021111```
@@ -1110,7 +1119,7 @@ choose which options to pass through into the resulting
11101119Instead of using ` unknown ` as the result type of ` getValue() ` ,
11111120we use ` ValueType ` , mentioned previously.
11121121Instead of using ` unknown ` as the value type for the
1113- ` properties() ` object, we use ` MessageValue ` ,
1122+ ` properties() ` object, we use ` ValueType ` ,
11141123since options can also be full ` MessageValue ` s with their own options.
11151124
11161125Without a mechanism for type signatures,
@@ -1147,8 +1156,8 @@ number : Number -> FormattedNumber
11471156date : Date -> FormattedDate
11481157```
11491158
1150- The resolved value type would be the same as
1151- in the formatted value model.
1159+ The ` MessageValue ` type would be defined the same way
1160+ as in the formatted value model.
11521161
11531162The difference is that built-in functions
11541163would not accept a "formatted result"
0 commit comments