@@ -3,9 +3,9 @@ title: Using MF2 with JavaScript and TypeScript
33sidebar_title : JavaScript/TypeScript
44---
55
6- The following guide explains how to use the ` mf2- messageformat` package to
7- format MF2 messages. For full API documentation, see the
8- [ API documentation site] ( https://messageformat.github.io/messageformat/api/ messageformat/ )
6+ The following guide explains how to use the ` messageformat ` package to format
7+ MF2 messages. For full API documentation, see the
8+ [ API documentation site] ( https://messageformat.github.io/modules/ messageformat )
99for the package. This guide shows the simplest use cases for the API. More
1010advanced uses are possible, which are documented in the API documentation.
1111
@@ -80,7 +80,7 @@ this case, the error is an "unresolved variable" error. In this example, the
8080error handling callback just logs the type of the error, for brevity. The full
8181error could also be logged. The ` MessageError ` class defines the structure of
8282errors: see
83- [ the API documentation] ( https://messageformat.github.io/messageformat/api/ messageformat.messageerror/ ) .
83+ [ the API documentation] ( https://messageformat.github.io/classes/ messageformat.MessageError ) .
8484
8585### ` formatToParts() ` method
8686
@@ -125,7 +125,7 @@ second argument.
125125## ` MessagePart ` type
126126
127127` MessagePart ` is defined as follows
128- ([ full documentation] ( https://messageformat.github.io/messageformat/api/ messageformat.messagepart/ ) ):
128+ ([ full documentation] ( https://messageformat.github.io/types/ messageformat.MessagePart ) ):
129129
130130``` ts
131131export type MessagePart =
@@ -172,7 +172,7 @@ with `MessageLiteralPart`). Since an expression's contents vary depending on
172172input, ` source ` and ` value ` are usually different from each other.
173173
174174See the full
175- [ MessageExpressionPart] ( https://messageformat.github.io/messageformat/api/ messageformat.messageexpressionpart/ )
175+ [ MessageExpressionPart] ( https://messageformat.github.io/interfaces/ messageformat.MessageExpressionPart )
176176documentation for more.
177177
178178## Writing custom functions
@@ -222,9 +222,9 @@ Some things to notice:
222222 values can have other properties, which are omitted here in the interest of
223223 providing the simplest possible example.
224224
225- > As of this writing, the online API docs aren't updated to include the
226- > ` MessageValue ` type, but it can be found in the code
227- > [ here ] ( https://github.com/messageformat/messageformat/blob/main/mf2/messageformat/src/functions/index.ts ) .
225+ See the full
226+ [ MessageValue] ( https://messageformat.github.io/interfaces/messageformat_functions.MessageValue )
227+ documentation for more .
228228
229229To clarify what we mean by "the operand type can be a ` MessageValue ` , consider
230230the following message:
@@ -256,5 +256,5 @@ A more robust method would check the type of its argument and, if passed a
256256` toUpperCase() ` on the result.
257257
258258For more details, see the
259- [ API documentation] ( https://messageformat.github.io/messageformat/api/ messageformat.messageformat._constructor_/ )
259+ [ API documentation] ( https://messageformat.github.io/classes/ messageformat.MessageFormat )
260260on the ` MessageFormat ` constructor.
0 commit comments