@tolki/types 1.12.0 → 1.13.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/types",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Utility TypeScript types for @tolki packages and Laravel HTTP responses.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -58,7 +58,16 @@
58
58
  "types": "./src/path-resolve.d.ts"
59
59
  },
60
60
  "./responses": {
61
- "types": "./src/responses.d.ts"
61
+ "types": "./src/resource-responses.d.ts"
62
+ },
63
+ "./resource-responses": {
64
+ "types": "./src/resource-responses.d.ts"
65
+ },
66
+ "./json-api": {
67
+ "types": "./src/json-api.d.ts"
68
+ },
69
+ "./routes": {
70
+ "types": "./src/routes.d.ts"
62
71
  },
63
72
  "./strings": {
64
73
  "types": "./src/strings.d.ts"
package/src/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export type * from "./arrays";
2
- export type * from "./collections";
3
- export type * from "./data";
4
- export type * from "./enums";
5
- export type * from "./json-api";
6
- export type * from "./lang";
7
- export type * from "./models";
8
- export type * from "./objects";
9
- export type * from "./pagination";
10
- export type * from "./path-resolve";
11
- export type * from "./resource-responses";
12
- export type * from "./routes";
13
- export type * from "./strings";
14
- export type * from "./utils";
1
+ export type * from "./arrays.js";
2
+ export type * from "./collections.js";
3
+ export type * from "./data.js";
4
+ export type * from "./enums.js";
5
+ export type * from "./json-api.js";
6
+ export type * from "./lang.js";
7
+ export type * from "./models.js";
8
+ export type * from "./objects.js";
9
+ export type * from "./pagination.js";
10
+ export type * from "./path-resolve.js";
11
+ export type * from "./resource-responses.js";
12
+ export type * from "./routes.js";
13
+ export type * from "./strings.js";
14
+ export type * from "./utils.js";
package/src/json-api.d.ts CHANGED
@@ -3,7 +3,7 @@ import type {
3
3
  JsonResourceLinks,
4
4
  JsonResourceMeta,
5
5
  JsonResourceSimpleMeta,
6
- } from "./resource-responses";
6
+ } from "./resource-responses.js";
7
7
 
8
8
  /**
9
9
  * A resource identifier object: how a relationship's `data` names a related resource.
package/src/lang.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import type { Countable } from "./data";
1
+ import type { Countable } from "./data.js";
2
2
  import type {
3
3
  ObjectDotPath,
4
4
  ObjectDotPathValue,
5
5
  ObjectResolvePath,
6
- } from "./path-resolve";
6
+ } from "./path-resolve.js";
7
+ import type { LocaleNormalizer } from "./utils.js";
7
8
 
8
9
  /** A tag callback receives the text between `<key>` and `</key>`. */
9
10
  type TagCallback = (children: string) => unknown;
@@ -251,6 +252,8 @@ interface LangOptions<TLines extends LangLines = LangLines> {
251
252
  readonly lines?: TLines;
252
253
  /** Fetches a locale's lines when it is first needed. */
253
254
  readonly load?: LocaleLinesLoader;
255
+ /** Converts every locale the lang is given, such as with `normalizeLocale`; unset uses each locale as given. */
256
+ readonly normalizeLocalesUsing?: LocaleNormalizer | null;
254
257
  }
255
258
 
256
259
  // An export list keeps the helpers above private: a .d.ts module without one exports every declaration.
package/src/objects.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ArrayInnerValue } from "./arrays";
2
- import type { KnownObjectKeys } from "./path-resolve";
1
+ import type { ArrayInnerValue } from "./arrays.js";
2
+ import type { KnownObjectKeys } from "./path-resolve.js";
3
3
 
4
4
  /**
5
5
  * Helper type to add a key-value pair to an object type
@@ -1,4 +1,4 @@
1
- import type { PaginatorLink } from "./pagination";
1
+ import type { PaginatorLink } from "./pagination.js";
2
2
 
3
3
  /**
4
4
  * The `meta` block of a resource collection paginated with `paginate()`.
package/src/utils.d.ts CHANGED
@@ -1 +1,4 @@
1
- export {};
1
+ /** Turns a locale into the spelling to use, such as `pt-BR` into `pt_BR`. */
2
+ type LocaleNormalizer = (locale: string) => string;
3
+
4
+ export type { LocaleNormalizer };