@@ -16,14 +16,14 @@ export type FluentFunction = (
1616 * them, which can then be used in the `toString` method together with a proper
1717 * `Intl` formatter.
1818 */
19- export class FluentType < T > {
19+ export abstract class FluentType < T > {
2020 /** The wrapped native value. */
2121 public value : T ;
2222
2323 /**
2424 * Create a `FluentType` instance.
2525 *
26- * @param value - JavaScript value to wrap.
26+ * @param value The JavaScript value to wrap.
2727 */
2828 constructor ( value : T ) {
2929 this . value = value ;
@@ -42,12 +42,8 @@ export class FluentType<T> {
4242 * Formatted values are suitable for use outside of the `FluentBundle`.
4343 * This method can use `Intl` formatters available through the `scope`
4444 * argument.
45- *
46- * @abstract
4745 */
48- toString ( scope : Scope ) : string {
49- throw new Error ( "Subclasses of FluentType must implement toString." ) ;
50- }
46+ abstract toString ( scope : Scope ) : string ;
5147}
5248
5349/**
@@ -56,7 +52,7 @@ export class FluentType<T> {
5652export class FluentNone extends FluentType < string > {
5753 /**
5854 * Create an instance of `FluentNone` with an optional fallback value.
59- * @param value - The fallback value of this `FluentNone`.
55+ * @param value The fallback value of this `FluentNone`.
6056 */
6157 constructor ( value = "???" ) {
6258 super ( value ) ;
@@ -72,14 +68,21 @@ export class FluentNone extends FluentType<string> {
7268
7369/**
7470 * A `FluentType` representing a number.
71+ *
72+ * A `FluentNumber` instance stores the number value of the number it
73+ * represents. It may also store an option bag of options which will be passed
74+ * to `Intl.NumerFormat` when the `FluentNumber` is formatted to a string.
7575 */
7676export class FluentNumber extends FluentType < number > {
77- /** Options passed to Intl.NumberFormat. */
77+ /** Options passed to ` Intl.NumberFormat` . */
7878 public opts : Intl . NumberFormatOptions ;
7979
8080 /**
8181 * Create an instance of `FluentNumber` with options to the
8282 * `Intl.NumberFormat` constructor.
83+ *
84+ * @param value The number value of this `FluentNumber`.
85+ * @param opts Options which will be passed to `Intl.NumberFormat`.
8386 */
8487 constructor ( value : number , opts : Intl . NumberFormatOptions = { } ) {
8588 super ( value ) ;
@@ -102,16 +105,22 @@ export class FluentNumber extends FluentType<number> {
102105
103106/**
104107 * A `FluentType` representing a date and time.
108+ *
109+ * A `FluentDateTime` instance stores the number value of the date it
110+ * represents, as a numerical timestamp in milliseconds. It may also store an
111+ * option bag of options which will be passed to `Intl.DateTimeFormat` when the
112+ * `FluentDateTime` is formatted to a string.
105113 */
106114export class FluentDateTime extends FluentType < number > {
107- /** Options passed to Intl.DateTimeFormat. */
115+ /** Options passed to ` Intl.DateTimeFormat` . */
108116 public opts : Intl . DateTimeFormatOptions ;
109117
110118 /**
111119 * Create an instance of `FluentDateTime` with options to the
112120 * `Intl.DateTimeFormat` constructor.
113- * @param value - timestamp in milliseconds
114- * @param opts
121+ *
122+ * @param value The number value of this `FluentDateTime`, in milliseconds.
123+ * @param opts Options which will be passed to `Intl.DateTimeFormat`.
115124 */
116125 constructor ( value : number , opts : Intl . DateTimeFormatOptions = { } ) {
117126 super ( value ) ;
0 commit comments