ts-fortress 3.0.1 → 3.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.
@@ -34,6 +34,7 @@ export { refine } from './other-types/refine.mjs';
34
34
  export { unknown } from './other-types/unknown.mjs';
35
35
  export { int8 } from './predefined/int8.mjs';
36
36
  export { JsonObject, JsonPrimitive, JsonValue } from './predefined/json.mjs';
37
+ export { nullable } from './predefined/nullable.mjs';
37
38
  export { uint8 } from './predefined/uint8.mjs';
38
39
  export { bigint, bigintLiteral } from './primitives/bigint.mjs';
39
40
  export { boolean, booleanLiteral } from './primitives/boolean.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"entry-point.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"entry-point.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -33,6 +33,7 @@ export { refine } from './other-types/refine.mjs';
33
33
  export { unknown } from './other-types/unknown.mjs';
34
34
  export { int8 } from './predefined/int8.mjs';
35
35
  export { JsonObject, JsonPrimitive, JsonValue } from './predefined/json.mjs';
36
+ export { nullable } from './predefined/nullable.mjs';
36
37
  export { uint8 } from './predefined/uint8.mjs';
37
38
  export { bigint, bigintLiteral } from './primitives/bigint.mjs';
38
39
  export { boolean, booleanLiteral } from './primitives/boolean.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,5 @@
1
1
  export * from './int8.mjs';
2
2
  export * from './json.mjs';
3
+ export * from './nullable.mjs';
3
4
  export * from './uint8.mjs';
4
5
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/predefined/index.mts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/predefined/index.mts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { int8 } from './int8.mjs';
2
2
  export { JsonObject, JsonPrimitive, JsonValue } from './json.mjs';
3
+ export { nullable } from './nullable.mjs';
3
4
  export { uint8 } from './uint8.mjs';
4
5
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,3 @@
1
+ import { type Type } from '../type.mjs';
2
+ export declare const nullable: <T>(type: Type<T>) => Type<T | undefined>;
3
+ //# sourceMappingURL=nullable.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullable.d.mts","sourceRoot":"","sources":["../../src/predefined/nullable.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAG,MAAM,IAAI,CAAC,CAAC,CAAC,KAAG,IAAI,CAAC,CAAC,GAAG,SAAS,CACjC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import 'ts-data-forge';
2
+ import { union } from '../compose/union.mjs';
3
+ import { undefinedType } from '../primitives/undefined.mjs';
4
+
5
+ const nullable = (type) => union([type, undefinedType]);
6
+
7
+ export { nullable };
8
+ //# sourceMappingURL=nullable.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullable.mjs","sources":["../../src/predefined/nullable.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIO,MAAM,QAAQ,GAAG,CAAK,IAAa,KACxC,KAAK,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-fortress",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript"
@@ -1,3 +1,4 @@
1
1
  export * from './int8.mjs';
2
2
  export * from './json.mjs';
3
+ export * from './nullable.mjs';
3
4
  export * from './uint8.mjs';
@@ -0,0 +1,6 @@
1
+ import { union } from '../compose/index.mjs';
2
+ import { undefinedType } from '../primitives/index.mjs';
3
+ import { type Type } from '../type.mjs';
4
+
5
+ export const nullable = <T,>(type: Type<T>): Type<T | undefined> =>
6
+ union([type, undefinedType]);