@escape-game-over/atlas 0.1.113 → 0.1.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +1 -1
- package/src/i18n/catalog.ts +6 -2
package/README.md
CHANGED
|
@@ -109,7 +109,9 @@ declares, and `override` and every `override*` is a patch over it.
|
|
|
109
109
|
The copy comes first so a deployment's other files can name its messages by
|
|
110
110
|
key. Anything declared before the project, its venues or its settings, types a
|
|
111
111
|
message as `CatalogKey<typeof messages>`: the default catalog's keys and the
|
|
112
|
-
deployment's own, exactly the ones `t()` takes. A typo fails on its line.
|
|
112
|
+
deployment's own, exactly the ones `t()` takes. A typo fails on its line. A
|
|
113
|
+
field that only ever names one kind of message narrows to it:
|
|
114
|
+
`CatalogKey<typeof messages, \`events.facts.${string}\`>`.
|
|
113
115
|
|
|
114
116
|
## The four steps
|
|
115
117
|
|
package/package.json
CHANGED
package/src/i18n/catalog.ts
CHANGED
|
@@ -36,10 +36,14 @@ export interface ProjectCatalog<Base, Published extends string, Override, Add> {
|
|
|
36
36
|
*
|
|
37
37
|
* What a site built from the project translates, so a key typed with it is
|
|
38
38
|
* one `t()` takes as it is.
|
|
39
|
+
*
|
|
40
|
+
* `Family` narrows to one kind of message, for a field that only ever names
|
|
41
|
+
* that kind: `CatalogKey<typeof messages, \`events.facts.${string}\`>` is the
|
|
42
|
+
* event facts the catalog has, the base's and the project's own.
|
|
39
43
|
*/
|
|
40
|
-
export type CatalogKey<C> =
|
|
44
|
+
export type CatalogKey<C, Family extends string = string> =
|
|
41
45
|
C extends ProjectCatalog<infer Base, string, unknown, infer Add>
|
|
42
|
-
? StringKeys<Base> | StringKeys<Add>
|
|
46
|
+
? Extract<StringKeys<Base> | StringKeys<Add>, Family>
|
|
43
47
|
: never;
|
|
44
48
|
|
|
45
49
|
/** The messages a site built from the catalog reads: the base's and its own. */
|