Skip to content

Commit 007aa9d

Browse files
committed
docs: fix StringGen and ValueGen documentation
1 parent a85f9c6 commit 007aa9d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ Signature:
21452145
consumeGen(valGen: ValueGen):
21462146
```
21472147

2148-
Turns a [`ValueGen`](#valuegen) into its final value.
2148+
Asynchronously turns a [`ValueGen`](#valuegen) into its final value.
21492149
ValueGen allows for tons of flexibility in how the value can be obtained. Calling this function will resolve the final value.
21502150

21512151
<details><summary><b>Example - click to view</b></summary>
@@ -2179,7 +2179,7 @@ Signature:
21792179
consumeStringGen(strGen: StringGen): Promise<string>
21802180
```
21812181

2182-
Turns a [`StringGen`](#stringgen) into its final string value.
2182+
Asynchronously turns a [`StringGen`](#stringgen) into its final string value.
21832183
StringGen allows for tons of flexibility in how the string can be obtained. Calling this function will resolve the final string.
21842184
Optionally you can use the template parameter to define the union of strings that the StringGen should yield.
21852185

@@ -2197,7 +2197,7 @@ export class MyTextPromptThing {
21972197
/** Shows the prompt dialog */
21982198
public async showPrompt() {
21992199
const promptText = await consumeStringGen(this.text);
2200-
const promptHtml = promptText.trim().replace(/\n/g, "<br>");
2200+
const promptHtml = promptText.trim().replace(/\n/gm, "<br>");
22012201

22022202
// ...
22032203
}
@@ -3065,7 +3065,9 @@ Signature:
30653065
StringGen<TStrUnion>
30663066
```
30673067

3068-
Describes a string that can be obtained in various ways, including via the type itself, a function that returns the type, a Promise that resolves to the type or either a sync or an async function that returns the type.
3068+
Describes a string that can be obtained in various ways, including via a [`Stringifiable`](#stringifiable) value, a function that returns a [`Stringifiable`](#stringifiable) value, a Promise that resolves to a [`Stringifiable`](#stringifiable) value or either a sync or an async function that returns a [`Stringifiable`](#stringifiable) value.
3069+
Remember that [`Stringifiable`](#stringifiable) is a type that describes a value that either is a string itself or can be converted to a string implicitly using `toString()`, template literal interpolation, or by passing it to `String()`, giving you the utmost flexibility in how the string can be passed.
3070+
30693071
Contrary to [`ValueGen`](#valuegen), this type allows for specifying a union of strings that the StringGen should yield, as long as it is loosely typed as just `string`.
30703072
Use it in the [`consumeStringGen()`](#consumestringgen) function to convert the given StringGen value to a plain string. Also refer to that function for an example.
30713073

0 commit comments

Comments
 (0)