rtt 1.1.1 → 1.1.2

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.
@@ -0,0 +1,20 @@
1
+ export declare interface $Type<T = unknown> {
2
+ name: string;
3
+ type?: T;
4
+ parent?: $Type | null | undefined;
5
+ generics?: $Type[] | null | undefined;
6
+ }
7
+
8
+ export declare function $type<T = unknown>(name: string, parent?: $Type | null | undefined, generics?: $Type[] | null | undefined): $Type<T>;
9
+
10
+ export declare type Brand<T extends string> = {
11
+ [brand]?: T;
12
+ };
13
+
14
+ declare const brand: unique symbol;
15
+
16
+ export declare function is<T extends $Type>(value: any, type: T): value is Exclude<T['type'], undefined>;
17
+
18
+ export declare function isType(a: $Type, b: $Type): boolean;
19
+
20
+ export { }
package/dist/index.js CHANGED
@@ -21,5 +21,3 @@ function $type(name, parent, generics) {
21
21
  }
22
22
  //#endregion
23
23
  export { $type, is, isType };
24
-
25
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,17 +1,13 @@
1
1
  {
2
- "author": "Nizami",
3
- "bugs": {
4
- "url": "https://github.com/nizami/rtt/issues"
5
- },
2
+ "name": "rtt",
3
+ "version": "1.1.2",
6
4
  "description": "Runtime Typescript Types",
7
- "devDependencies": {
8
- "@types/node": "^25.9.3",
9
- "barrelize": "^1.8.1",
10
- "typescript": "~6.0.3",
11
- "vite": "^8.0.16",
12
- "vite-plugin-dts": "^5.0.2",
13
- "vitest": "^4.1.8"
14
- },
5
+ "author": "Nizami",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
15
11
  "exports": {
16
12
  ".": {
17
13
  "import": "./dist/index.js",
@@ -21,26 +17,31 @@
21
17
  "files": [
22
18
  "dist"
23
19
  ],
24
- "homepage": "https://github.com/nizami/rtt#readme",
20
+ "scripts": {
21
+ "build": "barrelize && vite build",
22
+ "test": "barrelize && vitest run"
23
+ },
25
24
  "keywords": [
26
25
  "Typescript",
27
26
  "Runtime Types"
28
27
  ],
29
- "license": "MIT",
30
- "main": "index.js",
31
- "name": "rtt",
28
+ "homepage": "https://github.com/nizami/rtt#readme",
32
29
  "repository": {
33
30
  "type": "git",
34
31
  "url": "git+https://github.com/nizami/rtt.git"
35
32
  },
36
- "scripts": {
37
- "build": "barrelize && vite build",
38
- "test": "vitest run"
33
+ "bugs": {
34
+ "url": "https://github.com/nizami/rtt/issues"
35
+ },
36
+ "devDependencies": {
37
+ "@microsoft/api-extractor": "^7.58.9",
38
+ "@types/node": "^25.9.3",
39
+ "barrelize": "^1.8.1",
40
+ "typescript": "~6.0.3",
41
+ "unplugin-dts": "^1.0.2",
42
+ "vite": "^8.0.16",
43
+ "vitest": "^4.1.8"
39
44
  },
40
- "sideEffects": false,
41
- "type": "module",
42
- "types": "./dist/index.d.ts",
43
- "version": "1.1.1",
44
45
  "allowScripts": {
45
46
  "fsevents@2.3.3": true
46
47
  }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/is/is.ts","../src/type/type.ts"],"sourcesContent":["import {$Type} from '../type/type';\n\nexport function is<T extends $Type>(value: any, type: T): value is Exclude<T['type'], undefined> {\n return '$type' in value && isType(value?.$type, type);\n}\n\nexport function isType(a: $Type, b: $Type): boolean {\n if (a.parent && isType(a.parent, b)) {\n return true;\n }\n\n if (b.generics && b.generics.length > 0) {\n if (a.generics && a.generics.length === b.generics.length) {\n // todo Covariance and Contravariance ???\n return a.generics.every((x, i) => isType(x, b.generics![i]));\n }\n\n return false;\n }\n\n return a.name === b.name;\n}\n","export interface $Type<T = unknown> {\n name: string;\n type?: T;\n parent?: $Type | null | undefined;\n generics?: $Type[] | null | undefined;\n}\n\nexport function $type<T = unknown>(\n name: string,\n parent?: $Type | null | undefined,\n generics?: $Type[] | null | undefined,\n): $Type<T> {\n return {name, parent, generics};\n}\n"],"mappings":";AAEA,SAAgB,GAAoB,OAAY,MAAiD;CAC/F,OAAO,WAAW,SAAS,OAAO,OAAO,OAAO,IAAI;AACtD;AAEA,SAAgB,OAAO,GAAU,GAAmB;CAClD,IAAI,EAAE,UAAU,OAAO,EAAE,QAAQ,CAAC,GAChC,OAAO;CAGT,IAAI,EAAE,YAAY,EAAE,SAAS,SAAS,GAAG;EACvC,IAAI,EAAE,YAAY,EAAE,SAAS,WAAW,EAAE,SAAS,QAEjD,OAAO,EAAE,SAAS,OAAO,GAAG,MAAM,OAAO,GAAG,EAAE,SAAU,EAAE,CAAC;EAG7D,OAAO;CACT;CAEA,OAAO,EAAE,SAAS,EAAE;AACtB;;;ACdA,SAAgB,MACd,MACA,QACA,UACU;CACV,OAAO;EAAC;EAAM;EAAQ;CAAQ;AAChC"}
@@ -1,5 +0,0 @@
1
- declare const brand: unique symbol;
2
- export type Brand<T extends string> = {
3
- [brand]?: T;
4
- };
5
- export {};
@@ -1,3 +0,0 @@
1
- export * from './brand';
2
- export * from './is/is';
3
- export * from './type/type';
@@ -1,3 +0,0 @@
1
- import { $Type } from '../type/type';
2
- export declare function is<T extends $Type>(value: any, type: T): value is Exclude<T['type'], undefined>;
3
- export declare function isType(a: $Type, b: $Type): boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export interface $Type<T = unknown> {
2
- name: string;
3
- type?: T;
4
- parent?: $Type | null | undefined;
5
- generics?: $Type[] | null | undefined;
6
- }
7
- export declare function $type<T = unknown>(name: string, parent?: $Type | null | undefined, generics?: $Type[] | null | undefined): $Type<T>;
@@ -1 +0,0 @@
1
- export {};