@react-foundry/types-helpers 0.1.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (C) 2019-2025 Crown Copyright
4
+ Copyright (C) 2019-2026 Daniel A.C. Martin
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
+ of the Software, and to permit persons to whom the Software is furnished to do
11
+ so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ React Foundry - Types-Helpers
2
+ =============================
3
+
4
+ Types to aid in defining other types.
5
+
6
+
7
+ Using this package
8
+ ------------------
9
+
10
+ First install the package into your project:
11
+
12
+ ```shell
13
+ npm install -S -D @react-foundry/types-helpers
14
+ ```
15
+
16
+ Then use it in your code as follows:
17
+
18
+ ```ts
19
+ import type { Maybe, Promised } from '@react-foundry/types-helpers';
20
+
21
+ const foo = (): Maybe<string> => {
22
+ if (something) {
23
+ return 'yes';
24
+ }
25
+ };
26
+
27
+ type Fn = (): Promised<string>;
28
+
29
+ const bar: Fn = async () => 'result';
30
+ const baz: Fn = () => 'result';
31
+ ```
32
+
33
+
34
+ Working on this package
35
+ -----------------------
36
+
37
+ Before working on this package you must install its dependencies using
38
+ the following command:
39
+
40
+ ```shell
41
+ pnpm install
42
+ ```
43
+
44
+
45
+ ### Building
46
+
47
+ Build the package by compiling the source code.
48
+
49
+ ```shell
50
+ npm run build
51
+ ```
52
+
53
+
54
+ ### Clean-up
55
+
56
+ Remove any previously built files.
57
+
58
+ ```shell
59
+ npm run clean
60
+ ```
@@ -0,0 +1,2 @@
1
+ export type Maybe<T> = T | undefined;
2
+ export type Promised<T> = T | Promise<T>;
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@react-foundry/types-helpers",
3
+ "version": "0.1.0",
4
+ "description": "Types to aid in defining other types.",
5
+ "main": "dist/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.mjs",
10
+ "require": "./dist/index.js",
11
+ "default": "./dist/index.mjs"
12
+ }
13
+ },
14
+ "files": [
15
+ "/dist"
16
+ ],
17
+ "author": "Daniel A.C. Martin <npm@daniel-martin.co.uk> (http://daniel-martin.co.uk/)",
18
+ "license": "MIT",
19
+ "engines": {
20
+ "node": ">=18.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "jest": "30.2.0",
24
+ "jest-environment-jsdom": "30.2.0",
25
+ "ts-jest": "29.4.6",
26
+ "typescript": "5.9.3"
27
+ },
28
+ "scripts": {
29
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
30
+ "build": "npm run build:esm && npm run build:cjs",
31
+ "build:esm": "tsc -m es2022 && find dist -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\;",
32
+ "build:cjs": "tsc",
33
+ "clean": "rm -rf dist tsconfig.tsbuildinfo"
34
+ },
35
+ "module": "dist/index.mjs",
36
+ "typings": "dist/index.d.ts"
37
+ }